Save a keepalive-only cursor move at most every 10 minutes
Security / Vulnerability check (push) Successful in 41s
Test / Lint and test (push) Successful in 2m0s

Each ntfy keepalive, every 45 seconds, moved the cursor and rewrote the
subscription's state file with a synced write: about 1,900 a day per
subscription while idle, which wears an SD card. A cursor that only
keepalives or replayed repeats moved is now written at most every 10
minutes and at shutdown. A message printed, held or left out, a floor
change, a digest, and the cursor's first move from 0 are still written
within a second. A saved cursor that is behind costs only a longer
replay after a crash, and the saved IDs drop what it sends again; a
cursor still at 0 would mean a first start, which replays nothing.

Tests check the lazy cadence and a crash that loses the later moves,
the first move from 0 with an open event that has no time, and the
write at shutdown. The soak now writes its state 325 times instead of
2,702.

design.md records the decision. Its job-store entry now treats GORM on
SQLite as the first choice and has the plan investigate SQLite in WAL
mode, against bbolt and BadgerDB, before anything is built.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-11-30 20:20:31 -06:00
1 parent eb0c021044
commit ee65e72c44
6 files changed
+162 -24

No files matched your search

+5 -3
View File
@@ -383,9 +383,11 @@ How a subscription behaves:
"skip"` it is left out. The first message of a sequence prints plain,
even when its publisher named the sequence.
- **State.** The cursor, the IDs, the budget and the held messages are in
`<state_dir>/ntfy-<name>.json`, written at most once a second and at
shutdown, through a temporary file and a rename, so a crash leaves the
old file or the new one. A damaged file is ignored with a warning, and
`<state_dir>/ntfy-<name>.json`, written through a temporary file and a
rename, so a crash leaves the old file or the new one. It is written
within a second of a message being printed, held or left out, at most
every 10 minutes when only keepalives have moved the cursor, and at
shutdown. A damaged file is ignored with a warning, and
the subscription starts as if new. Held messages survive a restart.
- **Jobs.** Each card and digest is an ordinary job with the source
`ntfy:<name>`. Like any job, one that is still waiting when the daemon