mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[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:
parent
7fa9061015
commit
ddcb9cf8c8
2 changed files with 8 additions and 4 deletions
|
@ -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)
|
||||||
|
|
|
@ -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")
|
||||||
|
|
Loading…
Reference in a new issue