Give each ntfy digest a reference of its own
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:
1 parent
8b8b7da0c6
commit
64a72903d8
12 files changed
+431
-58
No files matched your search
@@ -220,7 +220,8 @@ Request bodies and the `Authorization` header are never sent to Sentry.
|
||||
or the token.
|
||||
- The worker logs each job with its `job_id`, its `source` (`print`,
|
||||
`module:<name>` or `ntfy:<name>`) and its `ref`, the ID of the request or
|
||||
ntfy message that sent it, never with what it prints.
|
||||
ntfy message that sent it, or a digest's own reference, never with what
|
||||
it prints.
|
||||
- Each [ntfy subscription](ntfy.md) logs with its `subscription` name,
|
||||
never with what a message says or its topic. It logs at WARN when its
|
||||
connection is lost, when its credentials are refused and while the queue
|
||||
|
||||
Reference in new issue
Block a user