Skip to content

Commit

Permalink
only reset writers on reindex instead of closing
Browse files Browse the repository at this point in the history
  • Loading branch information
chm-diederichs committed Jun 12, 2024
1 parent 2b65e54 commit 6003501
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1009,20 +1009,23 @@ module.exports = class Autobase extends ReadyResource {
await this.system.update()
}

const active = []
for (const w of this.activeWriters) active.push(w.core.key)

const sameIndexers = this.system.sameIndexers(this.linearizer.indexers)

await this._closeAllActiveWriters(true)
await this._makeLinearizer(this.system)
if (!sameIndexers) await this._viewStore.migrate()

this.version = this.system.version

this.queueFastForward()

if (this.localWriter) {
const value = await this.system.get(this.local.key)
for (const w of this.activeWriters) {
const value = await this.system.get(w.core.key)
const length = value ? value.length : 0
this.localWriter.reset(length)
w.reset(length)
this._resumeWriter(w)
}

if (!this.localWriter || !this.localWriter.isIndexer) return
Expand Down

0 comments on commit 6003501

Please sign in to comment.