Save a keepalive-only cursor move at most every 10 minutes
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:
1 parent
eb0c021044
commit
ee65e72c44
6 files changed
+162
-24
No files matched your search
@@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
// TestMain skips flushing state files to disk. The tests write them
|
||||
// thousands of times, and on a disk that is slow to sync the flushes alone
|
||||
// outlast the test timeout. TestSaveStateSyncs checks the flush itself.
|
||||
// hundreds of times, and on a disk that is slow to sync each flush costs
|
||||
// tens of milliseconds. TestSaveStateSyncs checks the flush itself.
|
||||
func TestMain(m *testing.M) {
|
||||
syncFile = func(*os.File) error { return nil }
|
||||
m.Run()
|
||||
|
||||
Reference in new issue
Block a user