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

[misc] downgrade a warning message from clients leaving non-joined rooms

This can now happen all the time, as we skip the join for clients that
 disconnect before joinProject/joinDoc completed.

(cherry-picked from commit f357931de74e088800f3cced3898cce4f251dad0)
Jakob Ackermann 6 лет назад
Родитель
Сommit
ddcb9cf8c8

+ 3 - 1
services/real-time/app/coffee/RoomManager.coffee

@@ -71,8 +71,10 @@ module.exports = RoomManager =
         # Ignore any requests to leave when the client is not actually in the
         # room. This can happen if the client sends spurious leaveDoc requests
         # for old docs after a reconnection.
+        # This can now happen all the time, as we skip the join for clients that
+        #  disconnect before joinProject/joinDoc completed.
         if !@_clientAlreadyInRoom(client, id)
-            logger.warn {client: client.id, entity, id}, "ignoring request from client to leave room it is not in"
+            logger.log {client: client.id, entity, id}, "ignoring request from client to leave room it is not in"
             return
         client.leave id
         afterCount = @_clientsInRoom(client, id)

+ 5 - 3
services/real-time/test/acceptance/coffee/LeaveDocTests.coffee

@@ -17,12 +17,14 @@ describe "leaveDoc", ->
 		@ops = ["mock", "doc", "ops"]
 		sinon.spy(logger, "error")
 		sinon.spy(logger, "warn")
+		sinon.spy(logger, "log")
 		@other_doc_id = FixturesManager.getRandomId()
 	
 	after ->
 		logger.error.restore() # remove the spy
 		logger.warn.restore()
-			
+		logger.log.restore()
+
 	describe "when joined to a doc", ->
 		beforeEach (done) ->
 			async.series [
@@ -80,5 +82,5 @@ describe "leaveDoc", ->
 					throw error if error?
 					done()
 
-			it "should trigger a warning only", ->
-				sinon.assert.calledWith(logger.warn, sinon.match.any, "ignoring request from client to leave room it is not in")
+			it "should trigger a low level message only", ->
+				sinon.assert.calledWith(logger.log, sinon.match.any, "ignoring request from client to leave room it is not in")