فهرست منبع

log the key for lock timeouts

Brian Gough 10 سال پیش
والد
کامیت
8e53d66079

+ 3 - 1
services/track-changes/app/coffee/LockManager.coffee

@@ -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?

+ 1 - 1
services/track-changes/test/unit/coffee/LockManager/LockManagerTests.coffee

@@ -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", ->