Give each ntfy digest a reference of its own
Security / Vulnerability check (push) Successful in 47s
Test / Lint and test (push) Successful in 2m6s

Every digest went to the print queue under the fixed reference
"digest", so after a crash the queue could not tell a digest it had
queued from a new one. Once queued jobs survive a restart, a crash in
the second between queueing a digest and saving the subscription's
state would print it twice; the same window exists today for a digest
that printed in that second.

A digest now gets a reference of its own when it is made, "digest_"
and a TypeID, and is saved with it in the subscription's state, apart
from the held messages. It is offered to the queue only once that save
has succeeded, and dropped once the queue takes it; while the state
file cannot be written, digests wait. A restart with a saved digest
offers that digest again first, with the same rows and reference, and
the queue's duplicate check answers with the earlier job while it holds
it. Messages held after a digest is made wait for the next one, also
while quiet hours delay the saved digest after a restart: added to a
digest the queue already holds, they would never print. The digest is
submitted as unique, like a card.

A digest can cost one more state save, two fsyncs. The reference shows
in the log lines and Sentry reports where "digest" did.

This completes stage 1c of docs/plans/job-store.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57_WolveandClaude Opus 5.5 committed 2026-12-01 13:50:57 -06:00
1 parent 8b8b7da0c6
commit 64a72903d8
12 files changed
+431 -58

No files matched your search

+9 -3
View File
@@ -91,10 +91,16 @@ a volume for the state and the token file next to the config, as
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.
starts as if new. Held messages survive a restart, and so does a digest
made and not yet queued: it is saved before it is queued, and a restart
queues it again, unchanged. While the file cannot be written, digests
wait.
- **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
shuts down is marked failed, and is not printed after the restart.
`ntfy:<name>` and a reference: a card's is its message's ID, and a
digest's is its own, `digest_` and a TypeID. A card or digest whose
source and reference the queue already holds is not queued again. Like
any job, one that is still waiting when the daemon shuts down is marked
failed, and is not printed after the restart.
## Securing the topics