Send worker idle waiting times to statsd

This commit is contained in:
James Allen 2014-08-07 13:16:11 +01:00
parent cab5509076
commit 773e17df66

View file

@ -3,6 +3,7 @@ logger = require('logger-sharelatex')
Keys = require('./RedisKeyBuilder')
redis = require('redis')
UpdateManager = require('./UpdateManager')
Metrics = require('./Metrics')
module.exports = WorkersManager =
createWorker: () ->
@ -13,7 +14,9 @@ module.exports = WorkersManager =
worker = {
client: client
waitForAndProcessUpdate: (callback = (error) ->) ->
timer = new Metrics.Timer "worker.waiting"
worker.client.blpop "pending-updates-list", 0, (error, result) ->
timer.done()
return callback(error) if error?
return callback() if !result?
[list_name, doc_key] = result