Merge pull request #61 from overleaf/bg-remove-redis-cluster-from-realtime

remove redis cluster from realtime
This commit is contained in:
Brian Gough 2019-07-15 09:47:37 +01:00 committed by GitHub
commit a724021900
2 changed files with 8 additions and 5 deletions

View file

@ -11,7 +11,7 @@ MESSAGE_SIZE_LOG_LIMIT = 1024 * 1024 # 1Mb
module.exports = DocumentUpdaterController =
# DocumentUpdaterController is responsible for updates that come via Redis
# Pub/Sub from the document updater.
rclientList: RedisClientManager.createClientList(settings.redis.pubsub, settings.redis.unusedpubsub)
rclientList: RedisClientManager.createClientList(settings.redis.pubsub)
listenForUpdatesFromDocumentUpdater: (io) ->
logger.log {rclients: @rclientList.length}, "listening for applied-ops events"
@ -21,9 +21,12 @@ module.exports = DocumentUpdaterController =
metrics.inc "rclient", 0.001 # global event rate metric
EventLogger.debugEvent(channel, message) if settings.debugEvents > 0
DocumentUpdaterController._processMessageFromDocumentUpdater(io, channel, message)
do (i) ->
rclient.on "message", () ->
metrics.inc "rclient-#{i}", 0.001 # per client event rate metric
# create metrics for each redis instance only when we have multiple redis clients
if @rclientList.length > 1
for rclient, i in @rclientList
do (i) ->
rclient.on "message", () ->
metrics.inc "rclient-#{i}", 0.001 # per client event rate metric
_processMessageFromDocumentUpdater: (io, channel, message) ->
SafeJsonParse.parse message, (error, message) ->

View file

@ -7,7 +7,7 @@ HealthCheckManager = require "./HealthCheckManager"
module.exports = WebsocketLoadBalancer =
rclientPubList: RedisClientManager.createClientList(Settings.redis.pubsub)
rclientSubList: RedisClientManager.createClientList(Settings.redis.pubsub, Settings.redis.unusedpubsub)
rclientSubList: RedisClientManager.createClientList(Settings.redis.pubsub)
emitToRoom: (room_id, message, payload...) ->
if !room_id?