Clean up, don't allocate an extra date

This commit is contained in:
Shane Kilkelly 2017-03-16 15:07:25 +00:00
parent 5ea83947dd
commit f397678589

View file

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