mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-02 23:16:02 +00:00
Resync after an op is not acknowledged rather than throwing an error
This commit is contained in:
parent
479b37a48c
commit
72dbefc5ad
3 changed files with 20 additions and 1 deletions
|
@ -87,6 +87,11 @@ define [
|
|||
wantToBeJoined: @wantToBeJoined
|
||||
update: update
|
||||
|
||||
if Math.random() < (@ide.disconnectRate or 0)
|
||||
console.log "Simulating disconnect"
|
||||
@ide.connectionManager.disconnect()
|
||||
return
|
||||
|
||||
if update?.doc == @doc_id and @doc?
|
||||
@doc.processUpdateFromServer update
|
||||
|
||||
|
@ -163,6 +168,13 @@ define [
|
|||
doc_id: @doc_id
|
||||
op: op
|
||||
@trigger "op:acknowledged"
|
||||
@doc.on "op:timeout", (op) =>
|
||||
@ide.pushEvent "op:timeout",
|
||||
doc_id: @doc_id
|
||||
op: op
|
||||
@trigger "op:timeout"
|
||||
ga?('send', 'event', 'error', "op timeout", "Op was now acknowledged - #{ide.socket.socket.transport.name}" )
|
||||
@ide.connectionManager.reconnectImmediately()
|
||||
@doc.on "flush", (inflightOp, pendingOp, version) =>
|
||||
@ide.pushEvent "flush",
|
||||
doc_id: @doc_id,
|
||||
|
|
|
@ -98,7 +98,7 @@ define [
|
|||
v: update.v
|
||||
op_sent_at: new Date()
|
||||
timer = setTimeout () =>
|
||||
@_handleError new Error("Doc op was not acknowledged in time"), meta
|
||||
@trigger "op:timeout", update
|
||||
, @INFLIGHT_OP_TIMEOUT
|
||||
@_doc.inflightCallbacks.push () =>
|
||||
clearTimeout timer
|
||||
|
|
|
@ -33,6 +33,13 @@ define [
|
|||
e.preventDefault()
|
||||
@tryReconnect()
|
||||
@hideModal()
|
||||
|
||||
reconnectImmediately: () ->
|
||||
@disconnect()
|
||||
@tryReconnect()
|
||||
|
||||
disconnect: () ->
|
||||
@socket.disconnect()
|
||||
|
||||
showModalAndStartAutoReconnect: () ->
|
||||
@hideModal()
|
||||
|
|
Loading…
Reference in a new issue