mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
send health check data to all redis backends
This commit is contained in:
parent
92f60690f3
commit
88b75b8baa
1 changed files with 10 additions and 6 deletions
|
@ -133,16 +133,20 @@ if Settings.forceDrainMsDelay?
|
|||
if Settings.continualPubsubTraffic
|
||||
console.log "continualPubsubTraffic enabled"
|
||||
|
||||
pubSubClient = redis.createClient(Settings.redis.documentupdater)
|
||||
redisClients = [redis.createClient(Settings.redis.documentupdater), redis.createClient(Settings.redis.realtime)]
|
||||
|
||||
publishJob = (channel, cb)->
|
||||
publishJob = (channel, callback)->
|
||||
checker = new HealthCheckManager(channel)
|
||||
logger.debug {channel:channel}, "sending pub to keep connection alive"
|
||||
json = JSON.stringify({health_check:true, key: checker.id, date: new Date().toString()})
|
||||
pubSubClient.publish channel, json, (err)->
|
||||
jobs = _.map redisClients, (rclient)->
|
||||
return (cb)->
|
||||
rclient.publish channel, json, (err)->
|
||||
if err?
|
||||
logger.err {err, channel}, "error publishing pubsub traffic to redis"
|
||||
cb(err)
|
||||
return cb(err)
|
||||
|
||||
async.series jobs, callback
|
||||
|
||||
runPubSubTraffic = ->
|
||||
async.map ["applied-ops", "editor-events"], publishJob, (err)->
|
||||
|
|
Loading…
Reference in a new issue