Merge pull request #77 from overleaf/bg-use-individual-channels

support per-doc pubsub channels
This commit is contained in:
Brian Gough 2019-07-30 09:35:38 +01:00 committed by GitHub
commit 2c0c3dc573
2 changed files with 9 additions and 2 deletions

View file

@ -36,4 +36,9 @@ module.exports = RealTimeRedisManager =
# create a unique message id using a counter
message_id = "doc:#{HOST}:#{RND}-#{COUNT++}"
data?._id = message_id
pubsubClient.publish "applied-ops", JSON.stringify(data)
# publish on separate channels for individual projects and docs when
# configured (needs realtime to be configured for this too).
if Settings.publishOnIndividualChannels
pubsubClient.publish "applied-ops:#{data.doc_id}", JSON.stringify(data)
else
pubsubClient.publish "applied-ops", JSON.stringify(data)

View file

@ -91,4 +91,6 @@ module.exports =
url: "mongodb://#{process.env["MONGO_HOST"] or "localhost"}/sharelatex"
sentry:
dsn: process.env.SENTRY_DSN
dsn: process.env.SENTRY_DSN
publishOnIndividualChannels: process.env['PUBLISH_ON_INDIVIDUAL_CHANNELS'] or false