* Phase-boundary fold: backfill the ENTIRE WAL now (off-thread, awaited). * Called between bulk phases — e.g. after parsing, before resolution's * first reads — so the next phase never pages a bulk-write-sized WAL on * the main thread (the post-parse read against a multi-GB WAL is what *
()
| 209 | * keeps the event loop (and the watchdog heartbeat) turning. |
| 210 | */ |
| 211 | async foldNow(): Promise<void> { |
| 212 | await this.drain(); |
| 213 | if (this.growthBytes() <= 0) return; |
| 214 | this.log(`foldNow: wal=${this.mb(this.db.getWalSizeBytes())} baseline=${this.mb(this.sizeAtLastFullBackfill)}`); |
| 215 | this.pause = this.backfillFully().finally(() => { this.pause = null; }); |
| 216 | await this.pause; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * With the writer parked on the returned promise, loop passive passes until |
no test coverage detected