Skip to content

Keep counted usage when a database write fails (idea from #52) - #66

Merged
UserJoo9 merged 4 commits into
mainfrom
usage-retry
Nov 24, 2026
Merged

UserJoo9 merged 4 commits into
mainfrom
usage-retry

Conversation

@UserJoo9

Copy link
Copy Markdown
Owner

#52 by @compnew2006 found a real gap: kernel counters are drained before the database write, so a failed write (database locked, disk full) lost those bytes and aborted the tick before blocks were evaluated.

This is a smaller fix for the same problem: the write is all-or-nothing (rollback on error), the failed batch stays in memory, is merged into the next tick and retried; the tick continues. No second connection per tick, no receipts table. Regression test fails on main, passes here. CHANGELOG credits #52.


Generated by Claude Code

…oing

The kernel counters are drained before the write, so a failed write lost
those bytes and aborted the tick before blocks were evaluated. The batch is
now all-or-nothing (rollback on error), kept in memory, merged into the next
tick's batch and retried. Simpler take on #52 by @compnew2006 (one shared
connection, no receipts table). Regression test.
startup() runs the first maintenance tick as a background task; it ran
between the test's awaits and made CI fail now and then. Same helper the
other manual-tick tests use; the assertion is unchanged.
@UserJoo9
UserJoo9 merged commit 3040505 into main Nov 24, 2026
2 checks passed
@UserJoo9
UserJoo9 deleted the usage-retry branch November 24, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant