diff --git a/packages/pouchdb-replication/src/replicate.js b/packages/pouchdb-replication/src/replicate.js index 672135fbaf..764c852da9 100644 --- a/packages/pouchdb-replication/src/replicate.js +++ b/packages/pouchdb-replication/src/replicate.js @@ -308,7 +308,7 @@ function replicate(src, target, opts, returnValue, result) { }; // update the checkpoint so we start from the right seq next time - if (!currentBatch && changes.last_seq > last_seq) { + if (!currentBatch && changes.results.length === 0) { writingCheckpoint = true; checkpointer.writeCheckpoint(changes.last_seq, session).then(function () { diff --git a/tests/integration/test.replication.js b/tests/integration/test.replication.js index f9d22d64d8..e4c1bcc978 100644 --- a/tests/integration/test.replication.js +++ b/tests/integration/test.replication.js @@ -1568,13 +1568,12 @@ adapters.forEach(function (adapters) { result.ok.should.equal(true); result.docs_written.should.equal(0); result.docs_read.should.equal(0); - changesSince.length.should.equal(2); - // the returned last_seq should match the 'since' - // requested from remote - result.last_seq.should.equal(changesSince[1]); + changesSince.length.should.equal(2, JSON.stringify(changesSince)); + // the 'since' parameter should be different on the // next request changesSince[0].should.not.equal(changesSince[1]); + // kick off a second replication return db.replicate.from(remote, replicationOpts); }).then(function (result) { @@ -1582,9 +1581,7 @@ adapters.forEach(function (adapters) { result.docs_written.should.equal(0); result.docs_read.should.equal(0); changesSince.length.should.equal(3); - // the returned last_seq should match the 'since' - // requested from remote - result.last_seq.should.equal(changesSince[2]); + // nothing has changed on the remote so 'since' // should be the same changesSince[1].should.equal(changesSince[2]);