diff --git a/services/web/app/coffee/Features/Editor/EditorRealTimeController.coffee b/services/web/app/coffee/Features/Editor/EditorRealTimeController.coffee index b5c1f511a4..76f4f909c1 100644 --- a/services/web/app/coffee/Features/Editor/EditorRealTimeController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorRealTimeController.coffee @@ -1,14 +1,11 @@ Settings = require 'settings-sharelatex' redis = require("redis-sharelatex") rclientPub = redis.createClient(Settings.redis.web) -rclientSub = redis.createMonitoredSubscriptionClient(Settings.redis.web) +rclientSub = redis.createClient(Settings.redis.web) module.exports = EditorRealTimeController = rclientPub: rclientPub rclientSub: rclientSub - - isRedisPubSubAlive: () -> - rclientSub.isAlive() emitToRoom: (room_id, message, payload...) -> @rclientPub.publish "editor-events", JSON.stringify @@ -21,9 +18,7 @@ module.exports = EditorRealTimeController = listenForEditorEvents: () -> @rclientSub.subscribe "editor-events" - @rclientSub.on "message", (channel, message) -> - return unless channel == "editor-events" - EditorRealTimeController._processEditorEvent(channel, message) + @rclientSub.on "message", @_processEditorEvent.bind(@) _processEditorEvent: (channel, message) -> io = require('../../infrastructure/Server').io diff --git a/services/web/app/coffee/Features/Editor/EditorUpdatesController.coffee b/services/web/app/coffee/Features/Editor/EditorUpdatesController.coffee index 23e206c504..0233c67aaa 100644 --- a/services/web/app/coffee/Features/Editor/EditorUpdatesController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorUpdatesController.coffee @@ -2,11 +2,10 @@ logger = require "logger-sharelatex" metrics = require('../../infrastructure/Metrics') Settings = require 'settings-sharelatex' redis = require("redis-sharelatex") +rclient = redis.createClient(Settings.redis.web) DocumentUpdaterHandler = require('../DocumentUpdater/DocumentUpdaterHandler') EditorRealTimeController = require("./EditorRealTimeController") -rclient = redis.createMonitoredSubscriptionClient(Settings.redis.web) - module.exports = EditorUpdatesController = _applyUpdate: (client, project_id, doc_id, update, callback = (error) ->) -> metrics.inc "editor.doc-update", 0.3 @@ -29,14 +28,9 @@ module.exports = EditorUpdatesController = update.meta.user_id = user_id EditorUpdatesController._applyUpdate client, project_id, doc_id, update - isRedisPubSubAlive: () -> - rclient.isAlive() - listenForUpdatesFromDocumentUpdater: () -> rclient.subscribe "applied-ops" - rclient.on "message", (channel, message) -> - return unless channel == "applied-ops" - EditorUpdatesController._processMessageFromDocumentUpdater(channel, message) + rclient.on "message", @_processMessageFromDocumentUpdater.bind(@) _processMessageFromDocumentUpdater: (channel, message) -> message = JSON.parse message diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index ae5436cfd7..aaf81a8f16 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -8,7 +8,6 @@ AuthorizationManager = require('./Features/Security/AuthorizationManager') EditorController = require("./Features/Editor/EditorController") EditorRouter = require("./Features/Editor/EditorRouter") EditorUpdatesController = require("./Features/Editor/EditorUpdatesController") -EditorRealTimeController = require("./Features/Editor/EditorRealTimeController") Settings = require('settings-sharelatex') TpdsController = require('./Features/ThirdPartyDataStore/TpdsController') SubscriptionRouter = require './Features/Subscription/SubscriptionRouter' @@ -176,18 +175,6 @@ module.exports = class Router req.session.destroy() app.get '/health_check', HealthCheckController.check - - app.get '/health_check/redis/doc_updates', (req, res, next) -> - if EditorUpdatesController.isRedisPubSubAlive() - res.send(200) - else - res.send(500) - - app.get '/health_check/redis/websockets', (req, res, next) -> - if EditorRealTimeController.isRedisPubSubAlive() - res.send(200) - else - res.send(500) app.get "/status/compiler/:Project_id", SecurityManager.requestCanAccessProject, (req, res) -> sendRes = _.once (statusCode, message)-> diff --git a/services/web/package.json b/services/web/package.json index 6a67008720..9b43687fd0 100644 --- a/services/web/package.json +++ b/services/web/package.json @@ -31,7 +31,7 @@ "optimist": "0.6.1", "redback": "0.4.0", "redis": "0.10.1", - "redis-sharelatex": "git+https://github.com/sharelatex/redis-sharelatex.git#master", + "redis-sharelatex": "~0.0.4", "request": "2.34.0", "rimraf": "2.2.6", "sanitizer": "0.1.1", diff --git a/services/web/test/UnitTests/coffee/Editor/EditorRealTimeControllerTests.coffee b/services/web/test/UnitTests/coffee/Editor/EditorRealTimeControllerTests.coffee index e4d174228d..9bb1fb3a04 100644 --- a/services/web/test/UnitTests/coffee/Editor/EditorRealTimeControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Editor/EditorRealTimeControllerTests.coffee @@ -9,8 +9,6 @@ describe "EditorRealTimeController", -> "redis-sharelatex": createClient: () -> auth:-> - createMonitoredSubscriptionClient: () -> - auth:-> "../../infrastructure/Server" : io: @io = {} @EditorRealTimeController.rclientPub = publish: sinon.stub() @EditorRealTimeController.rclientSub = diff --git a/services/web/test/UnitTests/coffee/Editor/EditorUpdatesControllerTests.coffee b/services/web/test/UnitTests/coffee/Editor/EditorUpdatesControllerTests.coffee index 1410e82473..74d6807bb5 100644 --- a/services/web/test/UnitTests/coffee/Editor/EditorUpdatesControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Editor/EditorUpdatesControllerTests.coffee @@ -18,7 +18,7 @@ describe "EditorUpdatesController", -> "../../infrastructure/Metrics" : @metrics = { set: sinon.stub(), inc: sinon.stub() } "../../infrastructure/Server" : io: @io = {} "redis-sharelatex" : - createMonitoredSubscriptionClient: ()=> + createClient: ()=> @rclient = {auth:->} describe "_applyUpdate", ->