Skip to content

Commit

Permalink
Fix #26 - clarify extend in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-marcacci committed Sep 21, 2017
1 parent bfe3520 commit dacdf26
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ redlock.lock('locks:account:322456', 1000).then(function(lock) {

// if you need more time, you can continue to extend
// the lock as long as you never let it expire

// this will extend the lock so that it expires
// approximitely 1s from when `extend` is called
return lock.extend(1000).then(function(lock){

// ...do something here...
Expand Down Expand Up @@ -196,7 +199,10 @@ using(redlock.disposer('locks:account:322456', 1000, unlockErrorHandler), functi
// ...do something here...

// if you need more time, you can continue to extend
// the lock until it expires
// the lock as long as you never let it expire

// this will extend the lock so that it expires
// approximitely 1s from when `extend` is called
return lock.extend(1000).then(function(extended){

// Note that redlock modifies the original lock,
Expand Down Expand Up @@ -271,7 +277,10 @@ redlock.lock('locks:account:322456', 1000, function(err, lock) {


// if you need more time, you can continue to extend
// the lock until it expires
// the lock as long as you never let it expire

// this will extend the lock so that it expires
// approximitely 1s from when `extend` is called
lock.extend(1000, function(err, lock){

// we failed to extend the lock on the resource
Expand Down Expand Up @@ -335,7 +344,7 @@ API Docs


### `Lock.prototype.extend(ttl, ?callback) => Promise<Lock>`
- `ttl (number)` time in ms to extend the lock's expiration
- `ttl (number)` time from now in ms to set as the lock's new expiration
- `callback (function)` callback returning:
- `err (Error)`
- `lock (Lock)`
Expand Down

0 comments on commit dacdf26

Please sign in to comment.