Skip to content

Commit

Permalink
Do not use _changes to retrieve last sequence number.
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Pitt committed Mar 20, 2019
1 parent 19f7ee4 commit b49af6d
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/cradle/database/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ Database.prototype.configureCacheFeed = function () {
// remotely.
if (this.opts.cache === 'follow') {
var self = this;
this.changes(function (err, list) {
this.query({
method: 'GET',
path: '',
query: {}
},
function (err, summary) {
var lastSeq = 0;
if (list && list.length !== 0)
lastSeq = list[list.length - 1]["seq"];
if (summary && summary.update_seq !== 0)
lastSeq = summary.update_seq;
self.cacheFeed = self.changes({ since: lastSeq, include_docs: true });
self.cacheFeed.on('change', function (change) {
var id = change["id"];
Expand Down

0 comments on commit b49af6d

Please sign in to comment.