[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)
This commit is contained in:
Jakob Ackermann 2020-05-19 17:41:20 +01:00
parent 7fa9061015
commit ddcb9cf8c8
2 changed files with 8 additions and 4 deletions

View file

@ -71,8 +71,10 @@ module.exports = RoomManager =
# Ignore any requests to leave when the client is not actually in the # Ignore any requests to leave when the client is not actually in the
# room. This can happen if the client sends spurious leaveDoc requests # room. This can happen if the client sends spurious leaveDoc requests
# for old docs after a reconnection. # 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) 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 return
client.leave id client.leave id
afterCount = @_clientsInRoom(client, id) afterCount = @_clientsInRoom(client, id)

View file

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