autobee 2.0.0-rc.4 → 2.0.0-rc.5

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 +11 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -478,6 +478,8 @@ module.exports = class Autobee extends ReadyResource {
478
478
  }
479
479
 
480
480
  async _drain() {
481
+ if (this._updating) await this._updating
482
+
481
483
  if (this.bootFrom) {
482
484
  await this._initFromHead(this.bootFrom)
483
485
  this.bootFrom = null
@@ -527,7 +529,15 @@ module.exports = class Autobee extends ReadyResource {
527
529
  if (this._interrupting) return
528
530
 
529
531
  if (this._needsUpdate) {
530
- await this._update(changes)
532
+ const updating = rrp()
533
+ this._updating = updating.promise
534
+
535
+ try {
536
+ await this._update(changes)
537
+ } finally {
538
+ this._updating = null
539
+ updating.resolve()
540
+ }
531
541
  }
532
542
  }
533
543
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autobee",
3
- "version": "2.0.0-rc.4",
3
+ "version": "2.0.0-rc.5",
4
4
  "description": "Bee based autobase",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Holepunch Inc.",