From d17ef183d01997c418e57cc95b5633575e91dd5b Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 21 Apr 2020 12:45:23 +0100 Subject: [PATCH] [Router] gracefully set and do not reset the ol_context --- services/real-time/app/coffee/Router.coffee | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/real-time/app/coffee/Router.coffee b/services/real-time/app/coffee/Router.coffee index f89e1d9eaf..b7d1ae2662 100644 --- a/services/real-time/app/coffee/Router.coffee +++ b/services/real-time/app/coffee/Router.coffee @@ -55,7 +55,7 @@ module.exports = Router = app.post "/client/:client_id/disconnect", httpAuth, HttpApiController.disconnectClient session.on 'connection', (error, client, session) -> - client.ol_context = {} + client.ol_context = {} unless client.ol_context client?.on "error", (err) -> logger.err { clientErr: err }, "socket.io client error" @@ -113,13 +113,9 @@ module.exports = Router = metrics.inc('socket-io.disconnect') metrics.gauge('socket-io.clients', io.sockets.clients()?.length - 1) - cleanup = () -> - delete client.ol_context WebsocketController.leaveProject io, client, (err) -> if err? - Router._handleError cleanup, err, client, "leaveProject" - else - cleanup() + Router._handleError (() ->), err, client, "leaveProject" # Variadic. The possible arguments: # doc_id, callback