From 826dd678e617cb71dba21e01461509e0ec5d1428 Mon Sep 17 00:00:00 2001 From: Joel Torstensson Date: Fri, 25 Jan 2019 15:22:12 +0100 Subject: [PATCH] fix: resolve sync promise if there are more entries locally than on pinning node --- src/keyValueStore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/keyValueStore.js b/src/keyValueStore.js index a3ce2cbd..eb5e2c83 100644 --- a/src/keyValueStore.js +++ b/src/keyValueStore.js @@ -51,7 +51,7 @@ class KeyValueStore { async _sync (numRemoteEntries) { this._requireLoad() // let toid = null - if (numRemoteEntries === this._db._oplog.values.length) return Promise.resolve() + if (numRemoteEntries <= this._db._oplog.values.length) return Promise.resolve() await new Promise((resolve, reject) => { if (!numRemoteEntries) { setTimeout(() => { @@ -61,7 +61,7 @@ class KeyValueStore { }, 3000) } this._db.events.on('replicated', () => { - if (numRemoteEntries === this._db._oplog.values.length) resolve() + if (numRemoteEntries <= this._db._oplog.values.length) resolve() }) /* this._db.events.on('replicate.progress', (_x, _y, _z, num, max) => {