fix(storage): a dead flush watch falls back to the 500ms poll, not the 30s sweep
The safety sweep is armed alongside the watch, and startFlushRequestPolling() declines to arm over an existing interval — so when a watch died mid-life the fallback did nothing and the store quietly answered flush requests on a 30s cadence instead of the 500ms one the door promises. The sweep is cleared first. A degrade nobody asked for is still a degrade.
This commit is contained in:
parent
16d2e1a97e
commit
5c22f9500c
1 changed files with 9 additions and 0 deletions
|
|
@ -2467,6 +2467,15 @@ export class FileSystemStorage extends BaseStorage {
|
||||||
)
|
)
|
||||||
this.flushWatcher?.close()
|
this.flushWatcher?.close()
|
||||||
this.flushWatcher = undefined
|
this.flushWatcher = undefined
|
||||||
|
// The SAFETY sweep must go first. It is already armed at 30s, and
|
||||||
|
// startFlushRequestPolling() declines to arm over an existing
|
||||||
|
// interval — so leaving it would quietly leave this store answering
|
||||||
|
// flush requests on a 30s cadence instead of the 500ms one the door
|
||||||
|
// promises. A degrade nobody asked for is still a degrade.
|
||||||
|
if (this.flushWatcherInterval) {
|
||||||
|
clearInterval(this.flushWatcherInterval)
|
||||||
|
this.flushWatcherInterval = undefined
|
||||||
|
}
|
||||||
this.startFlushRequestPolling(sweep)
|
this.startFlushRequestPolling(sweep)
|
||||||
})
|
})
|
||||||
if (typeof watcher.unref === 'function') watcher.unref()
|
if (typeof watcher.unref === 'function') watcher.unref()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue