From e99a7f6a8744262b616bf4aa1287225143e57971 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 15 Mar 2017 16:07:36 +0000 Subject: [PATCH] refactor --- libraries/metrics/timeAsyncMethod.coffee | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libraries/metrics/timeAsyncMethod.coffee b/libraries/metrics/timeAsyncMethod.coffee index 59fb12ea7a..ec530fcac0 100644 --- a/libraries/metrics/timeAsyncMethod.coffee +++ b/libraries/metrics/timeAsyncMethod.coffee @@ -16,15 +16,12 @@ module.exports = (obj, methodName, key, logger) -> "[Metrics] expected wrapped method '#{methodName}' to be invoked with a callback" ) - timer = new Metrics.Timer(key) + timer = new metrics.Timer(key) start = new Date() - realMethod.call this, firstArgs, (callbackArgs...) -> + realMethod.call this, firstArgs..., (callbackArgs...) -> timer.done() elapsedTime = new Date() - start if logger? - logger.log - key: key - time: elapsedTime - "[Metrics] timed async method call" + logger.log {key, elapsedTime}, "[Metrics] timed async method call" callback.apply this, callbackArgs