mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[WebsocketController] use a new JoinLeaveEpochMismatchError
This commit is contained in:
parent
0462e3e437
commit
50140f785a
2 changed files with 13 additions and 2 deletions
|
@ -38,6 +38,12 @@ class DocumentUpdaterRequestFailedError extends OError {
|
|||
}
|
||||
}
|
||||
|
||||
class JoinLeaveEpochMismatchError extends OError {
|
||||
constructor() {
|
||||
super('joinLeaveEpoch mismatch')
|
||||
}
|
||||
}
|
||||
|
||||
class MissingSessionError extends OError {
|
||||
constructor() {
|
||||
super('could not look up session by key')
|
||||
|
@ -80,6 +86,7 @@ module.exports = {
|
|||
ClientRequestedMissingOpsError,
|
||||
DataTooLargeToParseError,
|
||||
DocumentUpdaterRequestFailedError,
|
||||
JoinLeaveEpochMismatchError,
|
||||
MissingSessionError,
|
||||
NotAuthorizedError,
|
||||
NotJoinedError,
|
||||
|
|
|
@ -9,7 +9,11 @@ const DocumentUpdaterManager = require('./DocumentUpdaterManager')
|
|||
const ConnectedUsersManager = require('./ConnectedUsersManager')
|
||||
const WebsocketLoadBalancer = require('./WebsocketLoadBalancer')
|
||||
const RoomManager = require('./RoomManager')
|
||||
const { NotAuthorizedError, NotJoinedError } = require('./Errors')
|
||||
const {
|
||||
JoinLeaveEpochMismatchError,
|
||||
NotAuthorizedError,
|
||||
NotJoinedError
|
||||
} = require('./Errors')
|
||||
|
||||
let WebsocketController
|
||||
module.exports = WebsocketController = {
|
||||
|
@ -180,7 +184,7 @@ module.exports = WebsocketController = {
|
|||
}
|
||||
if (joinLeaveEpoch !== client.joinLeaveEpoch) {
|
||||
// another joinDoc or leaveDoc rpc overtook us
|
||||
return callback(new Error('joinLeaveEpoch mismatch'))
|
||||
return callback(new JoinLeaveEpochMismatchError())
|
||||
}
|
||||
// ensure the per-doc applied-ops channel is subscribed before sending the
|
||||
// doc to the client, so that no events are missed.
|
||||
|
|
Loading…
Reference in a new issue