Don't throw an error if we get an ack for our update more than once, since we may try sending it more than once

This commit is contained in:
James Allen 2016-05-26 17:31:21 +01:00
parent 6ea58d4d6c
commit 4bc31ae2b9

View file

@ -192,6 +192,13 @@ class Doc
callback error for callback in @inflightCallbacks callback error for callback in @inflightCallbacks
else else
# The op applied successfully. # The op applied successfully.
# We may get multiple acks of the same message if we retried it,
# so its ok if we receive an ack for a version that we've already gone past.
# If so, just ignore it
if msg.v < @version
return
throw new Error('Invalid version from server') unless msg.v == @version throw new Error('Invalid version from server') unless msg.v == @version
@serverOps[@version] = oldInflightOp @serverOps[@version] = oldInflightOp