corestore 7.0.17 → 7.0.19

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 +6 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -18,14 +18,14 @@ class StreamTracker {
18
18
 
19
19
  add (stream, isExternal) {
20
20
  const record = { index: 0, stream, isExternal }
21
- this.records.push(record)
21
+ record.index = this.records.push(record) - 1
22
22
  return record
23
23
  }
24
24
 
25
25
  remove (record) {
26
26
  const popped = this.records.pop()
27
27
  if (popped === record) return
28
- this.records[popped.index = record.index] = popped
28
+ this.records[(popped.index = record.index)] = popped
29
29
  }
30
30
 
31
31
  attachAll (core) {
@@ -182,7 +182,10 @@ class CoreTracker {
182
182
  this._gcing.clear()
183
183
 
184
184
  const all = []
185
- for (const core of this.map.values()) all.push(core.close())
185
+ for (const core of this.map.values()) {
186
+ core.onidle = noop // no reentry
187
+ all.push(core.close())
188
+ }
186
189
  this.map.clear()
187
190
 
188
191
  return Promise.all(all)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "corestore",
3
- "version": "7.0.17",
3
+ "version": "7.0.19",
4
4
  "description": "A Hypercore factory that simplifies managing collections of cores.",
5
5
  "main": "index.js",
6
6
  "files": [