send health check data to all redis backends

This commit is contained in:
Henry Oswald 2019-07-02 14:56:50 +01:00
parent 92f60690f3
commit 88b75b8baa

View file

@ -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)->
if err?
logger.err {err, channel}, "error publishing pubsub traffic to redis"
cb(err)
jobs = _.map redisClients, (rclient)->
return (cb)->
rclient.publish channel, json, (err)->
if err?
logger.err {err, channel}, "error publishing pubsub traffic to redis"
return cb(err)
async.series jobs, callback
runPubSubTraffic = ->
async.map ["applied-ops", "editor-events"], publishJob, (err)->