Write each handler batch from its flush goroutine, outside the mutex #83

Open
clawbot wants to merge 1 commits from issue-65-batch-write-off-mutex into next
1 Commits
Author SHA1 Message Date
sneak 73793e68e0 Write each handler batch from its flush goroutine, outside the mutex (closes #65)
check / check (push) Canceled after 0s
The AS, peer and prefix handlers wrote their batch to the database while
holding the mutex HandleMessage needs, and HandleMessage wrote a full batch
itself. For as long as a write took, the handler took nothing off its queue,
and the streamer dropped updates once the queue was half full.

Now only the flush goroutine writes: it takes the batch under the mutex,
releases it, then writes. A full batch wakes the flush goroutine instead.
Stop still writes what the handler holds.

While a write runs, the next batch has no size limit; the README memory
section says so.

Model: opus-5-5
2026-10-14 17:50:38 +00:00