diff --git a/lib/core-index-stream.js b/lib/core-index-stream.js index 97b1771..0991a1c 100644 --- a/lib/core-index-stream.js +++ b/lib/core-index-stream.js @@ -107,7 +107,7 @@ class CoreIndexStream extends Readable { this.#state = 'indexing' this.emit('indexing') this.#bitfield = await Bitfield.open(this.#storage) - await this.#core.update() + await this.#core.update({ wait: true }) this.#core.on('append', this[kHandleAppend]) this.#core.on('download', this[kHandleDownload]) } diff --git a/test/multi-core-indexer.test.js b/test/multi-core-indexer.test.js index 687b8b7..3597145 100644 --- a/test/multi-core-indexer.test.js +++ b/test/multi-core-indexer.test.js @@ -125,7 +125,7 @@ test('Appends from a replicated core are indexed', async (t) => { for (const [i, core] of localCores.entries()) { const remote = (remoteCores[i] = await create(core.key)) replicate(core, remoteCores[i], t) - await remote.update() + await remote.update({ wait: true }) await remote.download({ start: 0, end: remote.length }).downloaded() } /** @type {Entry[]} */ diff --git a/test/unit-tests/core-index-stream.test.js b/test/unit-tests/core-index-stream.test.js index 495ed44..9e3e3ce 100644 --- a/test/unit-tests/core-index-stream.test.js +++ b/test/unit-tests/core-index-stream.test.js @@ -126,7 +126,7 @@ test('Appends from a replicated core are indexed', async (t) => { const b = await create(a.key) replicate(a, b, t) - await b.update() + await b.update({ wait: true }) const range1 = b.download({ start: 0, end: b.length }) await range1.downloaded() diff --git a/test/unit-tests/multi-core-index-stream.test.js b/test/unit-tests/multi-core-index-stream.test.js index 0e0d5cd..e2dab0b 100644 --- a/test/unit-tests/multi-core-index-stream.test.js +++ b/test/unit-tests/multi-core-index-stream.test.js @@ -157,7 +157,7 @@ test('Appends from a replicated core are indexed', async (t) => { for (const [i, core] of localCores.entries()) { const remote = (remoteCores[i] = await create(core.key)) replicate(core, remoteCores[i], t) - await remote.update() + await remote.update({ wait: true }) const range = remote.download({ start: 0, end: remote.length }) await range.downloaded() indexStreams.push(new CoreIndexStream(core, ram()))