From 343ec9d708cc8b386d159977be8a3885a7202776 Mon Sep 17 00:00:00 2001 From: James Allen Date: Thu, 26 May 2016 15:46:45 +0100 Subject: [PATCH] Add in flags that track how often each callback is called --- services/real-time/app/coffee/Router.coffee | 2 +- services/real-time/app/coffee/WebsocketController.coffee | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/services/real-time/app/coffee/Router.coffee b/services/real-time/app/coffee/Router.coffee index 0fee1cb837..9a055e0b86 100644 --- a/services/real-time/app/coffee/Router.coffee +++ b/services/real-time/app/coffee/Router.coffee @@ -23,7 +23,7 @@ module.exports = Router = attrs.err = error logger.error attrs, "server side error in #{method}" # Don't return raw error to prevent leaking server side info - return callback {message: "Something went wrong"} + return callback {message: "Something went wrong in real-time service"} configure: (app, io, session) -> app.set("io", io) diff --git a/services/real-time/app/coffee/WebsocketController.coffee b/services/real-time/app/coffee/WebsocketController.coffee index bb2049f61d..af7b6aac98 100644 --- a/services/real-time/app/coffee/WebsocketController.coffee +++ b/services/real-time/app/coffee/WebsocketController.coffee @@ -149,12 +149,16 @@ module.exports = WebsocketController = applyOtUpdate: (client, doc_id, update, callback = (error) ->) -> + cbc_0 = 0 # Callback counter + cbc_1 = 0 Utils.getClientAttributes client, ["user_id", "project_id"], (error, {user_id, project_id}) -> + cbc_0++ return callback(error) if error? return callback(new Error("no project_id found on client")) if !project_id? # Omit this logging for now since it's likely too noisey #logger.log {user_id, project_id, doc_id, client_id: client.id, update: update}, "applying update" AuthorizationManager.assertClientCanEditProject client, (error) -> + cbc_1++ if error? logger.error {err: error, doc_id, client_id: client.id, version: update.v}, "client is not authorized to make update" setTimeout () -> @@ -169,7 +173,7 @@ module.exports = WebsocketController = metrics.set "editor.active-projects", project_id, 0.3 metrics.set "editor.active-users", user_id, 0.3 - logger.log {user_id, doc_id, project_id, client_id: client.id, version: update.v}, "sending update to doc updater" + logger.log {user_id, doc_id, project_id, client_id: client.id, version: update.v, cbc_0, cbc_1}, "sending update to doc updater" DocumentUpdaterManager.queueChange project_id, doc_id, update, (error) -> if error?