corestore 6.2.0 → 6.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -200,6 +200,7 @@ module.exports = class Corestore extends EventEmitter {
|
|
|
200
200
|
if (this._root._closing) throw new Error('The corestore is closed')
|
|
201
201
|
this.cores.set(id, core)
|
|
202
202
|
core.ready().then(() => {
|
|
203
|
+
if (core.closing) return // extra safety here as ready is a tick after open
|
|
203
204
|
for (const { stream } of this._replicationStreams) {
|
|
204
205
|
core.replicate(stream, { session: true })
|
|
205
206
|
}
|
|
@@ -273,7 +274,7 @@ module.exports = class Corestore extends EventEmitter {
|
|
|
273
274
|
})
|
|
274
275
|
|
|
275
276
|
for (const core of this.cores.values()) {
|
|
276
|
-
if (!core.opened) continue // If the core is not opened, it will be replicated in preload.
|
|
277
|
+
if (!core.opened || core.closing) continue // If the core is not opened, it will be replicated in preload.
|
|
277
278
|
core.replicate(stream, { session: true })
|
|
278
279
|
}
|
|
279
280
|
|