mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
add logging for redis clients at start up
This commit is contained in:
parent
dd54789e2b
commit
689a75f397
3 changed files with 15 additions and 1 deletions
|
@ -14,6 +14,7 @@ module.exports = DocumentUpdaterController =
|
||||||
rclientList: RedisClientManager.createClientList(settings.redis.pubsub, settings.redis.unusedpubsub)
|
rclientList: RedisClientManager.createClientList(settings.redis.pubsub, settings.redis.unusedpubsub)
|
||||||
|
|
||||||
listenForUpdatesFromDocumentUpdater: (io) ->
|
listenForUpdatesFromDocumentUpdater: (io) ->
|
||||||
|
logger.log {rclients: @rclientList.length}, "listening for applied-ops events"
|
||||||
for rclient, i in @rclientList
|
for rclient, i in @rclientList
|
||||||
rclient.subscribe "applied-ops"
|
rclient.subscribe "applied-ops"
|
||||||
rclient.on "message", (channel, message) ->
|
rclient.on "message", (channel, message) ->
|
||||||
|
|
|
@ -1,7 +1,18 @@
|
||||||
redis = require("redis-sharelatex")
|
redis = require("redis-sharelatex")
|
||||||
|
logger = require 'logger-sharelatex'
|
||||||
|
|
||||||
module.exports = RedisClientManager =
|
module.exports = RedisClientManager =
|
||||||
createClientList: (configs...) ->
|
createClientList: (configs...) ->
|
||||||
# create a dynamic list of redis clients, excluding any configurations which are not defined
|
# create a dynamic list of redis clients, excluding any configurations which are not defined
|
||||||
clientList = (redis.createClient(x) for x in configs when x?)
|
clientList = for x in configs when x?
|
||||||
|
redisType = if x.cluster?
|
||||||
|
"cluster"
|
||||||
|
else if x.sentinels?
|
||||||
|
"sentinel"
|
||||||
|
else if x.host?
|
||||||
|
"single"
|
||||||
|
else
|
||||||
|
"unknown"
|
||||||
|
logger.log {redis: redisType}, "creating redis client"
|
||||||
|
redis.createClient(x)
|
||||||
return clientList
|
return clientList
|
|
@ -25,6 +25,8 @@ module.exports = WebsocketLoadBalancer =
|
||||||
@emitToRoom "all", message, payload...
|
@emitToRoom "all", message, payload...
|
||||||
|
|
||||||
listenForEditorEvents: (io) ->
|
listenForEditorEvents: (io) ->
|
||||||
|
logger.log {rclients: @rclientPubList.length}, "publishing editor events"
|
||||||
|
logger.log {rclients: @rclientSubList.length}, "listening for editor events"
|
||||||
for rclientSub in @rclientSubList
|
for rclientSub in @rclientSubList
|
||||||
rclientSub.subscribe "editor-events"
|
rclientSub.subscribe "editor-events"
|
||||||
rclientSub.on "message", (channel, message) ->
|
rclientSub.on "message", (channel, message) ->
|
||||||
|
|
Loading…
Reference in a new issue