Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

Fix: Puller would lose checkpoint if first doc couldn't be pulled

If the first new revision received by the puller fails to be read or
written, the last-sequence ID won't advance. But the puller was instead
getting a null sequence ID instead of the checkpointed one, and trying
to save that, which deleted the checkpoint. So the next pull would start
over from the beginning.
  • Loading branch information...
commit 5fe553456864b2d2ca25b2844b4c271b47170077 1 parent 38113fe
@snej snej authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 Source/TDPuller.m
6 Source/TDPuller.m
@@ -70,6 +70,12 @@ - (void) beginReplicating {
if (!_pendingSequences) {
_pendingSequences = [[TDSequenceMap alloc] init];
+ if (_lastSequence != nil) {
+ // Prime _pendingSequences so its checkpointedValue will reflect the last known seq:
+ SequenceNumber seq = [_pendingSequences addValue: _lastSequence];
+ [_pendingSequences removeSequence: seq];
+ AssertEqual(_pendingSequences.checkpointedValue, _lastSequence);
+ }
_caughtUp = NO;

0 comments on commit 5fe5534

Please sign in to comment.
Something went wrong with that request. Please try again.