mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
refactor
This commit is contained in:
parent
3cb0ab2784
commit
e99a7f6a87
1 changed files with 3 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue