mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-29 12:13:43 -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"
|
"[Metrics] expected wrapped method '#{methodName}' to be invoked with a callback"
|
||||||
)
|
)
|
||||||
|
|
||||||
timer = new Metrics.Timer(key)
|
timer = new metrics.Timer(key)
|
||||||
start = new Date()
|
start = new Date()
|
||||||
|
|
||||||
realMethod.call this, firstArgs, (callbackArgs...) ->
|
realMethod.call this, firstArgs..., (callbackArgs...) ->
|
||||||
timer.done()
|
timer.done()
|
||||||
elapsedTime = new Date() - start
|
elapsedTime = new Date() - start
|
||||||
if logger?
|
if logger?
|
||||||
logger.log
|
logger.log {key, elapsedTime}, "[Metrics] timed async method call"
|
||||||
key: key
|
|
||||||
time: elapsedTime
|
|
||||||
"[Metrics] timed async method call"
|
|
||||||
callback.apply this, callbackArgs
|
callback.apply this, callbackArgs
|
||||||
|
|
Loading…
Reference in a new issue