use separate loop for pendingUpdates metric

This commit is contained in:
Brian Gough 2020-04-01 14:50:55 +01:00
parent fcb72b9bf7
commit 00b11bda96

View file

@ -21,6 +21,9 @@ module.exports = RealTimeRedisManager =
multi.exec (error, replys) ->
return callback(error) if error?
jsonUpdates = replys[0]
for jsonUpdate in jsonUpdates
# record metric for each update removed from queue
metrics.summary "redis.pendingUpdates", jsonUpdate.length, {status: "pop"}
updates = []
for jsonUpdate in jsonUpdates
try
@ -28,8 +31,6 @@ module.exports = RealTimeRedisManager =
catch e
return callback e
updates.push update
# record metric for updates removed from queue
metrics.summary "redis.pendingUpdates", jsonUpdate.length, {status: "pop"}
callback error, updates
getUpdatesLength: (doc_id, callback)->