Browse Source

use null instead of err in callbacks on success

Brian Gough 9 years ago
parent
commit
c21cc013f3
1 changed files with 5 additions and 5 deletions
  1. 5 5
      services/document-updater/app/coffee/LockManager.coffee

+ 5 - 5
services/document-updater/app/coffee/LockManager.coffee

@@ -46,11 +46,11 @@ module.exports = LockManager =
 						return callback(err) if err? # error freeing lock
 						return callback(err) if err? # error freeing lock
 						callback null, false # tell caller they didn't get the lock
 						callback null, false # tell caller they didn't get the lock
 				else
 				else
-					callback err, true, lockValue
+					callback null, true, lockValue
 			else
 			else
 				metrics.inc "doc-blocking"
 				metrics.inc "doc-blocking"
 				profile.log("doc is locked").end()
 				profile.log("doc is locked").end()
-				callback err, false
+				callback null, false
 
 
 	getLock: (doc_id, callback = (error, lockValue) ->) ->
 	getLock: (doc_id, callback = (error, lockValue) ->) ->
 		startTime = Date.now()
 		startTime = Date.now()
@@ -81,10 +81,10 @@ module.exports = LockManager =
 			exists = parseInt exists
 			exists = parseInt exists
 			if exists == 1
 			if exists == 1
 				metrics.inc "doc-blocking"
 				metrics.inc "doc-blocking"
-				callback err, false
+				callback null, false
 			else
 			else
 				metrics.inc "doc-not-blocking"
 				metrics.inc "doc-not-blocking"
-				callback err, true
+				callback null, true
 
 
 	releaseLock: (doc_id, lockValue, callback)->
 	releaseLock: (doc_id, lockValue, callback)->
 		key = keys.blockingKey(doc_id:doc_id)
 		key = keys.blockingKey(doc_id:doc_id)
@@ -99,4 +99,4 @@ module.exports = LockManager =
 				return callback(new Error("tried to release timed out lock"))
 				return callback(new Error("tried to release timed out lock"))
 			else
 			else
 				profile.log("unlockScript:ok").end()
 				profile.log("unlockScript:ok").end()
-				callback(err,result)
+				callback(null,result)