We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 702d6a4 commit a68a6f3Copy full SHA for a68a6f3
index.js
@@ -56,7 +56,12 @@ class CorestoreNetworker extends Nanoresource {
56
announce: opts.announce,
57
lookup: opts.lookup
58
})
59
- if (opts.flush !== false) {
+
60
+ const flushedProm = flush.bind(this)()
61
+ if (opts.flush !== false) await flushedProm
62
+ else flushedProm.catch(() => {})
63
64
+ async function flush () {
65
await new Promise((resolve, reject) => {
66
this.swarm.flush(err => {
67
if (err) reject(err)
@@ -235,7 +240,7 @@ class CorestoreNetworker extends Nanoresource {
235
240
}
236
241
237
242
async _configure (discoveryKey, opts) {
238
- if (!this.swarm) await this.open()
243
+ if (!this.swarm) this.open()
239
244
if (this.swarm && this.swarm.destroyed) return
245
246
const config = {
0 commit comments