revert the removal of realtime keyspace

This commit is contained in:
Henry Oswald 2019-02-07 15:27:51 +00:00
parent b5564095f3
commit ecaef6485b
6 changed files with 17 additions and 8 deletions

View file

@ -10,7 +10,7 @@ RateLimitManager = require('./RateLimitManager')
module.exports = DispatchManager =
createDispatcher: (RateLimiter) ->
client = redis.createClient(Settings.redis.documentupdater)
client = redis.createClient(Settings.redis.realtime)
worker = {
client: client
_waitForUpdateThenDispatchWorker: (callback = (error) ->) ->

View file

@ -1,6 +1,6 @@
Settings = require('settings-sharelatex')
rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
Keys = Settings.redis.documentupdater.key_schema
rclient = require("redis-sharelatex").createClient(Settings.redis.realtime)
Keys = Settings.redis.realtime.key_schema
logger = require('logger-sharelatex')
MAX_OPS_PER_ITERATION = 8 # process a limited number of ops for safety

View file

@ -21,6 +21,15 @@ 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 ""
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"
host: process.env["HISTORY_REDIS_HOST"] or process.env["REDIS_HOST"] or "localhost"

View file

@ -1,10 +1,10 @@
Settings = require('settings-sharelatex')
rclient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
keys = Settings.redis.documentupdater.key_schema
rclient = require("redis-sharelatex").createClient(Settings.redis.realtime)
keys = Settings.redis.realtime.key_schema
request = require("request").defaults(jar: false)
async = require "async"
rclient_sub = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
rclient_sub = require("redis-sharelatex").createClient(Settings.redis.realtime)
rclient_sub.subscribe "applied-ops"
rclient_sub.setMaxListeners(0)

View file

@ -13,7 +13,7 @@ describe "DispatchManager", ->
"logger-sharelatex": @logger = { log: sinon.stub() }
"settings-sharelatex": @settings =
redis:
documentupdater: {}
realtime: {}
"redis-sharelatex": @redis = {}
"./RateLimitManager": {}
"./Metrics":

View file

@ -15,7 +15,7 @@ describe "RealTimeRedisManager", ->
"redis-sharelatex": createClient: () => @rclient
"settings-sharelatex":
redis:
documentupdater: @settings =
realtime: @settings =
key_schema:
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
"logger-sharelatex": { log: () -> }