log the key for lock timeouts

This commit is contained in:
Brian Gough
2016-01-12 10:47:15 +00:00
parent 6199532d08
commit 8e53d66079
2 changed files with 4 additions and 2 deletions
@@ -36,7 +36,9 @@ module.exports = LockManager =
startTime = Date.now()
do attempt = () ->
if Date.now() - startTime > LockManager.MAX_LOCK_WAIT_TIME
return callback(new Error("Timeout"))
e = new Error("Timeout")
e.key = key
return callback(e)
LockManager.tryLock key, (error, gotLock, lockValue) ->
return callback(error) if error?
@@ -129,7 +129,7 @@ describe "LockManager", ->
done()
it "should return the callback with an error", ->
@callback.calledWith(new Error("timeout")).should.equal true
@callback.calledWith(sinon.match.instanceOf(Error)).should.equal true
describe "runWithLock", ->
describe "with successful run", ->