Просмотр исходного кода

Add in flags that track how often each callback is called

James Allen 10 лет назад
Родитель
Сommit
343ec9d708

+ 1 - 1
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)

+ 5 - 1
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?