blind-peer 2.9.2 → 2.9.3

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 +3 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -61,6 +61,8 @@ class CoreTracker {
61
61
  }
62
62
 
63
63
  gc() {
64
+ if (!this.record) throw new Error('Record must be set before calling gc')
65
+
64
66
  // TODO: support gc-ing till less than last block (required hypercore to support getting byteLength at arbitrary versions)
65
67
  const bytesCleared = this.core.byteLength
66
68
  const blocksCleared = this.core.length
@@ -336,6 +338,7 @@ class BlindPeer extends ReadyResource {
336
338
 
337
339
  try {
338
340
  const tracker = this.activeReplication.get(id)
341
+ if (!tracker.record) await tracker.refresh()
339
342
  const coreBytesCleared = tracker.gc()
340
343
  bytesCleared += coreBytesCleared
341
344
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blind-peer",
3
- "version": "2.9.2",
3
+ "version": "2.9.3",
4
4
  "description": "Blind peers help keep hypercores available",
5
5
  "main": "index.js",
6
6
  "bin": {