From b49af6db01bc397aab353a7eaabfc74fb3098371 Mon Sep 17 00:00:00 2001 From: Graham Pitt Date: Wed, 20 Mar 2019 06:44:08 +0000 Subject: [PATCH] Do not use _changes to retrieve last sequence number. --- lib/cradle/database/index.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/cradle/database/index.js b/lib/cradle/database/index.js index 667352a..1c1ef71 100644 --- a/lib/cradle/database/index.js +++ b/lib/cradle/database/index.js @@ -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"];