Explorar o código

Clean up, don't allocate an extra date

Shane Kilkelly %!s(int64=9) %!d(string=hai) anos
pai
achega
f397678589
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      libraries/metrics/timeAsyncMethod.coffee

+ 1 - 3
libraries/metrics/timeAsyncMethod.coffee

@@ -17,11 +17,9 @@ module.exports = (obj, methodName, key, logger) ->
 			)
 
 		timer = new metrics.Timer(key)
-		start = new Date()
 
 		realMethod.call this, firstArgs..., (callbackArgs...) ->
-			timer.done()
-			elapsedTime = new Date() - start
+			elapsedTime = timer.done()
 			if logger?
 				logger.log {key, elapsedTime}, "[Metrics] timed async method call"
 			callback.apply this, callbackArgs