mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Delay flushes performed after getting an op acknowledgement as well
This commit is contained in:
@@ -200,7 +200,7 @@ class Doc
|
|||||||
callback null, oldInflightOp for callback in @inflightCallbacks
|
callback null, oldInflightOp for callback in @inflightCallbacks
|
||||||
|
|
||||||
# Send the next op.
|
# Send the next op.
|
||||||
@flush()
|
@delayedFlush()
|
||||||
|
|
||||||
else if msg.op
|
else if msg.op
|
||||||
# We got a new op from the server.
|
# We got a new op from the server.
|
||||||
@@ -247,7 +247,7 @@ class Doc
|
|||||||
# Only one op can be in-flight at a time, so if an op is already on its way then
|
# Only one op can be in-flight at a time, so if an op is already on its way then
|
||||||
# this method does nothing.
|
# this method does nothing.
|
||||||
flush: =>
|
flush: =>
|
||||||
delete @flushTimeout
|
@flushTimeout = null
|
||||||
#console.log "CALLED FLUSH"
|
#console.log "CALLED FLUSH"
|
||||||
|
|
||||||
return unless @connection.state == 'ok' and @inflightOp == null and @pendingOp != null
|
return unless @connection.state == 'ok' and @inflightOp == null and @pendingOp != null
|
||||||
@@ -279,8 +279,9 @@ class Doc
|
|||||||
|
|
||||||
@emit 'change', op
|
@emit 'change', op
|
||||||
|
|
||||||
# A timeout is used so if the user sends multiple ops at the same time, they'll be composed
|
@delayedFlush()
|
||||||
# & sent together.
|
|
||||||
|
delayedFlush: () ->
|
||||||
if !@flushTimeout?
|
if !@flushTimeout?
|
||||||
@flushTimeout = setTimeout @flush, @_flushDelay || 0
|
@flushTimeout = setTimeout @flush, @_flushDelay || 0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user