mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #60 from overleaf/ho-pubsub-healthcheck
Ho pubsub healthcheck
This commit is contained in:
commit
6d4649c842
1 changed files with 6 additions and 8 deletions
|
@ -134,20 +134,18 @@ if Settings.forceDrainMsDelay?
|
||||||
if Settings.continualPubsubTraffic
|
if Settings.continualPubsubTraffic
|
||||||
console.log "continualPubsubTraffic enabled"
|
console.log "continualPubsubTraffic enabled"
|
||||||
|
|
||||||
redisClients = [redis.createClient(Settings.redis.documentupdater), redis.createClient(Settings.redis.realtime)]
|
pubsubClient = redis.createClient(Settings.redis.pubsub)
|
||||||
|
clusterClient = redis.createClient(Settings.redis.websessions)
|
||||||
|
|
||||||
publishJob = (channel, callback)->
|
publishJob = (channel, callback)->
|
||||||
checker = new HealthCheckManager(channel)
|
checker = new HealthCheckManager(channel)
|
||||||
logger.debug {channel:channel}, "sending pub to keep connection alive"
|
logger.debug {channel:channel}, "sending pub to keep connection alive"
|
||||||
json = JSON.stringify({health_check:true, key: checker.id, date: new Date().toString()})
|
json = JSON.stringify({health_check:true, key: checker.id, date: new Date().toString()})
|
||||||
jobs = _.map redisClients, (rclient)->
|
pubsubClient.publish channel, json, (err)->
|
||||||
return (cb)->
|
|
||||||
rclient.publish channel, json, (err)->
|
|
||||||
if err?
|
if err?
|
||||||
logger.err {err, channel}, "error publishing pubsub traffic to redis"
|
logger.err {err, channel}, "error publishing pubsub traffic to redis"
|
||||||
return cb(err)
|
clusterClient.publish "cluster-continual-traffic", {keep: "alive"}, callback
|
||||||
|
|
||||||
async.series jobs, callback
|
|
||||||
|
|
||||||
runPubSubTraffic = ->
|
runPubSubTraffic = ->
|
||||||
async.map ["applied-ops", "editor-events"], publishJob, (err)->
|
async.map ["applied-ops", "editor-events"], publishJob, (err)->
|
||||||
|
|
Loading…
Reference in a new issue