corestore 6.15.12 → 6.15.14

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.
Files changed (2) hide show
  1. package/index.js +8 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -292,13 +292,20 @@ module.exports = class Corestore extends ReadyResource {
292
292
  keyPair: hasKeyPair ? keyPair : null
293
293
  })
294
294
 
295
- if (this._root.closing) throw new Error('The corestore is closed')
295
+ if (this._root.closing) {
296
+ try {
297
+ await core.close()
298
+ } catch {}
299
+ throw new Error('The corestore is closed')
300
+ }
301
+
296
302
  this.cores.set(id, core)
297
303
  this._noCoreCache.delete(id)
298
304
  core.ready().then(() => {
299
305
  if (core.closing) return // extra safety here as ready is a tick after open
300
306
  if (hasKeyPair) core.setKeyPair(keyPair)
301
307
  this._emitCore('core-open', core)
308
+ if (this.passive) return
302
309
 
303
310
  const ondownloading = () => {
304
311
  for (const { stream } of this._replicationStreams) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "6.15.12",
3
+ "version": "6.15.14",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "scripts": {