Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Commit

Permalink
fix: resolve sync promise if there are more entries locally than on p…
Browse files Browse the repository at this point in the history
…inning node
  • Loading branch information
oed committed Jan 25, 2019
1 parent 3e6eec5 commit 826dd67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/keyValueStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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) => {
Expand Down

0 comments on commit 826dd67

Please sign in to comment.