mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
remove redis.realtime
real time pushes data into the document updater redis instance
This commit is contained in:
parent
9437cf8b02
commit
25e1ad7491
8 changed files with 16 additions and 30 deletions
|
@ -70,15 +70,6 @@ app.get '/status', (req, res)->
|
|||
else
|
||||
res.send('document updater is alive')
|
||||
|
||||
webRedisClient = require("redis-sharelatex").createClient(Settings.redis.realtime)
|
||||
app.get "/health_check/redis", (req, res, next) ->
|
||||
webRedisClient.healthCheck (error) ->
|
||||
if error?
|
||||
logger.err {err: error}, "failed redis health check"
|
||||
res.send 500
|
||||
else
|
||||
res.send 200
|
||||
|
||||
docUpdaterRedisClient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
|
||||
app.get "/health_check/redis_cluster", (req, res, next) ->
|
||||
docUpdaterRedisClient.healthCheck (error) ->
|
||||
|
|
|
@ -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.documentupdater)
|
||||
Keys = Settings.redis.documentupdater.key_schema
|
||||
logger = require('logger-sharelatex')
|
||||
|
||||
MAX_OPS_PER_ITERATION = 8 # process a limited number of ops for safety
|
||||
|
|
|
@ -20,18 +20,6 @@ module.exports =
|
|||
url: "http://#{process.env["PROJECT_HISTORY_HOST"] or "localhost"}:3054"
|
||||
|
||||
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 ""
|
||||
key_schema:
|
||||
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
||||
# cluster: [{
|
||||
# port: "7000"
|
||||
# host: "localhost"
|
||||
# }]
|
||||
# key_schema:
|
||||
# pendingUpdates: ({doc_id}) -> "PendingUpdates:{#{doc_id}}"
|
||||
documentupdater:
|
||||
port: process.env["DOC_UPDATER_REDIS_PORT"] or process.env["REDIS_PORT"] or "6379"
|
||||
host: process.env["DOC_UPDATER_REDIS_HOST"] or process.env["REDIS_HOST"] or "localhost"
|
||||
|
@ -49,6 +37,7 @@ module.exports =
|
|||
projectHistoryId: ({doc_id}) -> "ProjectHistoryId:#{doc_id}"
|
||||
projectState: ({project_id}) -> "ProjectState:#{project_id}"
|
||||
unflushedTime: ({doc_id}) -> "UnflushedTime:#{doc_id}"
|
||||
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
||||
# cluster: [{
|
||||
# port: "7000"
|
||||
# host: "localhost"
|
||||
|
|
|
@ -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.documentupdater)
|
||||
rclient_sub.subscribe "applied-ops"
|
||||
rclient_sub.setMaxListeners(0)
|
||||
|
||||
|
|
|
@ -4,16 +4,21 @@ should = chai.should()
|
|||
modulePath = "../../../../app/js/DispatchManager.js"
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
|
||||
|
||||
describe "DispatchManager", ->
|
||||
beforeEach ->
|
||||
@timeout(3000)
|
||||
@DispatchManager = SandboxedModule.require modulePath, requires:
|
||||
"./UpdateManager" : @UpdateManager = {}
|
||||
"logger-sharelatex": @logger = { log: sinon.stub() }
|
||||
"settings-sharelatex": @settings =
|
||||
redis:
|
||||
realtime: {}
|
||||
documentupdater: {}
|
||||
"redis-sharelatex": @redis = {}
|
||||
"./RateLimitManager": {}
|
||||
"./Metrics":
|
||||
Timer: ->
|
||||
done: ->
|
||||
@callback = sinon.stub()
|
||||
@RateLimiter = { run: (task,cb) -> task(cb) } # run task without rate limit
|
||||
|
||||
|
@ -22,7 +27,6 @@ describe "DispatchManager", ->
|
|||
@client =
|
||||
auth: sinon.stub()
|
||||
@redis.createClient = sinon.stub().returns @client
|
||||
|
||||
@worker = @DispatchManager.createDispatcher(@RateLimiter)
|
||||
|
||||
it "should create a new redis client", ->
|
||||
|
|
|
@ -24,6 +24,8 @@ describe "ProjectHistoryRedisManager", ->
|
|||
}
|
||||
"redis-sharelatex":
|
||||
createClient: () => @rclient
|
||||
"logger-sharelatex":
|
||||
log:->
|
||||
globals:
|
||||
JSON: @JSON = JSON
|
||||
|
||||
|
|
|
@ -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