mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #75 from overleaf/ho-pubsub-connection
Remove real time redis connection and consolidate on pubsub
This commit is contained in:
commit
06ad0f7acd
6 changed files with 14 additions and 15 deletions
|
@ -73,9 +73,9 @@ app.get '/status', (req, res)->
|
|||
else
|
||||
res.send('document updater is alive')
|
||||
|
||||
webRedisClient = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
pubsubClient = require("redis-sharelatex").createClient(Settings.redis.pubsub)
|
||||
app.get "/health_check/redis", (req, res, next) ->
|
||||
webRedisClient.healthCheck (error) ->
|
||||
pubsubClient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis health check"
|
||||
res.send 500
|
||||
|
|
|
@ -10,7 +10,7 @@ RateLimitManager = require('./RateLimitManager')
|
|||
|
||||
module.exports = DispatchManager =
|
||||
createDispatcher: (RateLimiter) ->
|
||||
client = redis.createClient(Settings.redis.realtime)
|
||||
client = redis.createClient(Settings.redis.documentupdater)
|
||||
worker = {
|
||||
client: client
|
||||
_waitForUpdateThenDispatchWorker: (callback = (error) ->) ->
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
Settings = require('settings-sharelatex')
|
||||
rclient = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
Keys = Settings.redis.realtime.key_schema
|
||||
rclient = require("redis-sharelatex").createClient(Settings.redis.pubsub)
|
||||
Keys = Settings.redis.documentupdater.key_schema
|
||||
logger = require('logger-sharelatex')
|
||||
os = require "os"
|
||||
crypto = require "crypto"
|
||||
|
|
|
@ -21,14 +21,12 @@ module.exports =
|
|||
|
||||
redis:
|
||||
|
||||
realtime:
|
||||
port: process.env["REAL_TIME_REDIS_PORT"] or process.env["REDIS_PORT"] or "6379"
|
||||
host: process.env["REAL_TIME_REDIS_HOST"] or process.env["REDIS_HOST"] or "localhost"
|
||||
password: process.env["REAL_TIME_REDIS_PASSWORD"] or process.env["REDIS_PASSWORD"] or ""
|
||||
pubsub:
|
||||
host: process.env['PUBSUB_REDIS_HOST'] or process.env['REDIS_HOST'] or "localhost"
|
||||
port: process.env['PUBSUB_REDIS_PORT'] or process.env['REDIS_PORT'] or "6379"
|
||||
password: process.env["PUBSUB_REDIS_PASSWORD"] or process.env["REDIS_PASSWORD"] or ""
|
||||
redisOptions:
|
||||
keepAlive: 100
|
||||
key_schema:
|
||||
pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
|
||||
|
||||
history:
|
||||
port: process.env["HISTORY_REDIS_PORT"] or process.env["REDIS_PORT"] or "6379"
|
||||
|
@ -81,6 +79,7 @@ module.exports =
|
|||
pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
|
||||
lastUpdatedBy: ({doc_id}) -> "lastUpdatedBy:{#{doc_id}}"
|
||||
lastUpdatedAt: ({doc_id}) -> "lastUpdatedAt:{#{doc_id}}"
|
||||
pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
|
||||
redisOptions:
|
||||
keepAlive: 100
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
Settings = require('settings-sharelatex')
|
||||
rclient = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
keys = Settings.redis.realtime.key_schema
|
||||
rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
|
||||
keys = Settings.redis.documentupdater.key_schema
|
||||
request = require("request").defaults(jar: false)
|
||||
async = require "async"
|
||||
|
||||
rclient_sub = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
rclient_sub = require("redis-sharelatex").createClient(Settings.redis.pubsub)
|
||||
rclient_sub.subscribe "applied-ops"
|
||||
rclient_sub.setMaxListeners(0)
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe "RealTimeRedisManager", ->
|
|||
"redis-sharelatex": createClient: () => @rclient
|
||||
"settings-sharelatex":
|
||||
redis:
|
||||
realtime: @settings =
|
||||
documentupdater: @settings =
|
||||
key_schema:
|
||||
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
||||
"logger-sharelatex": { log: () -> }
|
||||
|
|
Loading…
Reference in a new issue