share/ShareJS — pull request #330 by devongovett (2014-08-07 23:49:35+00:00)
Title: Clear inflight op when 'Op already submitted' error is received

Periodically I'm seeing ShareJS get into a weird state where it simply does not submit operations to the server. Then users complain because their data is not being saved. My guess is that ShareJS somehow gets into a state where it thinks that there is still data in flight, and so it does not submit further operations.

I found that one of these states occurs when an `Op already submitted` error is received by the client. There is a special case for this error so that it doesn't try to rollback the operation, but it also never cleared the inflight op and so after this error no operations are submitted to the server. This change calls `_clearInflightOp` when the error is `Op already submitted`, but ignores the error and does not try to rollback. I *think* that is the right thing to do in this state.

I'm still not exactly sure how ShareJS gets into this state (why would an op be submitted more than once to begin with?) or whether this is the only case (I've seen it happen where nothing is logged on either the client or server), but this should help in this particular case. Let me know where my reasoning might be off.