autobee 1.0.5 → 1.0.7
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/lib/writers.js +17 -5
- package/package.json +1 -1
package/lib/writers.js
CHANGED
|
@@ -83,11 +83,7 @@ class ActiveWriters {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
for (const writer of this.active.values()) {
|
|
86
|
-
await writer.
|
|
87
|
-
|
|
88
|
-
if (writer !== this.localWriter && !writer.isIndexer) {
|
|
89
|
-
await writer.detachAndClose()
|
|
90
|
-
}
|
|
86
|
+
await writer.reset()
|
|
91
87
|
}
|
|
92
88
|
}
|
|
93
89
|
|
|
@@ -270,6 +266,22 @@ class Writer {
|
|
|
270
266
|
this.removePending()
|
|
271
267
|
}
|
|
272
268
|
|
|
269
|
+
async reset() {
|
|
270
|
+
this.removePending()
|
|
271
|
+
|
|
272
|
+
if (this.waiting) {
|
|
273
|
+
this.writers.triggers.remove(this.waiting)
|
|
274
|
+
this.waiting = null
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
const length = await this.update()
|
|
278
|
+
if (length < this.core.length) {
|
|
279
|
+
this.addPending()
|
|
280
|
+
} else if (this !== this.writers.localWriter && !this.isIndexer) {
|
|
281
|
+
await this.detachAndClose()
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
273
285
|
close() {
|
|
274
286
|
this.isClosed = true
|
|
275
287
|
|