mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-06 10:01:28 +00:00
Add in extra logging about size of messages
This commit is contained in:
parent
503b766dcc
commit
0372fa3203
2 changed files with 7 additions and 2 deletions
|
@ -3,6 +3,8 @@ settings = require 'settings-sharelatex'
|
|||
redis = require("redis-sharelatex")
|
||||
rclient = redis.createClient(settings.redis.web)
|
||||
|
||||
MESSAGE_SIZE_LOG_LIMIT = 1024 * 1024 * 1024 # 1Mb
|
||||
|
||||
module.exports = DocumentUpdaterController =
|
||||
# DocumentUpdaterController is responsible for updates that come via Redis
|
||||
# Pub/Sub from the document updater.
|
||||
|
@ -13,6 +15,8 @@ module.exports = DocumentUpdaterController =
|
|||
DocumentUpdaterController._processMessageFromDocumentUpdater(io, channel, message)
|
||||
|
||||
_processMessageFromDocumentUpdater: (io, channel, message) ->
|
||||
if message.length > MESSAGE_SIZE_LOG_LIMIT
|
||||
logger.log {length: message.length, head: message.slice(0,200)}, "large message from doc updater"
|
||||
message = JSON.parse message
|
||||
if message.op?
|
||||
DocumentUpdaterController._applyUpdateFromDocumentUpdater(io, message.doc_id, message.op)
|
||||
|
|
|
@ -12,11 +12,12 @@ module.exports = WebsocketLoadBalancer =
|
|||
if !room_id?
|
||||
logger.warn {message, payload}, "no room_id provided, ignoring emitToRoom"
|
||||
return
|
||||
logger.log {room_id, message, payload}, "emitting to room"
|
||||
@rclientPub.publish "editor-events", JSON.stringify
|
||||
data = JSON.stringify
|
||||
room_id: room_id
|
||||
message: message
|
||||
payload: payload
|
||||
logger.log {room_id, message, payload, length: data.length}, "emitting to room"
|
||||
@rclientPub.publish "editor-events", data
|
||||
|
||||
emitToAll: (message, payload...) ->
|
||||
@emitToRoom "all", message, payload...
|
||||
|
|
Loading…
Add table
Reference in a new issue