diff --git a/services/document-updater/app.coffee b/services/document-updater/app.coffee index 66d941b832..829cc029eb 100644 --- a/services/document-updater/app.coffee +++ b/services/document-updater/app.coffee @@ -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 diff --git a/services/document-updater/app/coffee/DispatchManager.coffee b/services/document-updater/app/coffee/DispatchManager.coffee index 419aa17de7..375f3b98dc 100644 --- a/services/document-updater/app/coffee/DispatchManager.coffee +++ b/services/document-updater/app/coffee/DispatchManager.coffee @@ -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) ->) -> diff --git a/services/document-updater/app/coffee/RealTimeRedisManager.coffee b/services/document-updater/app/coffee/RealTimeRedisManager.coffee index da6f47f2ff..5644fe82a0 100644 --- a/services/document-updater/app/coffee/RealTimeRedisManager.coffee +++ b/services/document-updater/app/coffee/RealTimeRedisManager.coffee @@ -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" diff --git a/services/document-updater/config/settings.defaults.coffee b/services/document-updater/config/settings.defaults.coffee index f68077bb8b..f359ab38f0 100755 --- a/services/document-updater/config/settings.defaults.coffee +++ b/services/document-updater/config/settings.defaults.coffee @@ -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 diff --git a/services/document-updater/test/acceptance/coffee/helpers/DocUpdaterClient.coffee b/services/document-updater/test/acceptance/coffee/helpers/DocUpdaterClient.coffee index 7f50d64372..82dba20685 100644 --- a/services/document-updater/test/acceptance/coffee/helpers/DocUpdaterClient.coffee +++ b/services/document-updater/test/acceptance/coffee/helpers/DocUpdaterClient.coffee @@ -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) diff --git a/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.coffee b/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.coffee index 32ec3d9020..2d23e948a2 100644 --- a/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.coffee +++ b/services/document-updater/test/unit/coffee/RealTimeRedisManager/RealTimeRedisManagerTests.coffee @@ -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: () -> }