(err, response)
| 261 | }); |
| 262 | |
| 263 | function loop(err, response) { |
| 264 | if(err) self.emit('clientError', err); |
| 265 | |
| 266 | // - If the response is less than the resource length, than one or |
| 267 | // more resources failed to unlock: |
| 268 | // - It may have been re-acquired by another process; |
| 269 | // - It may hava already been manually released; |
| 270 | // - It may have expired; |
| 271 | |
| 272 | if(response === resource.length || response === '' + resource.length) |
| 273 | votes++; |
| 274 | |
| 275 | if(waiting-- > 1) return; |
| 276 | |
| 277 | // SUCCESS: there is concensus and the lock is released |
| 278 | if(votes >= quorum) |
| 279 | return resolve(); |
| 280 | |
| 281 | // FAILURE: the lock could not be released |
| 282 | return reject(new LockError('Unable to fully release the lock on resource "' + lock.resource + '".')); |
| 283 | } |
| 284 | }) |
| 285 | |
| 286 | // optionally run callback |
nothing calls this directly
no outgoing calls
no test coverage detected