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
|
||||
# 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)
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in a new issue