Stop the print queue when its store fails

A store write that fails after start, such as on a full disk or a
damaged page, must stop the daemon, and nothing is retried: a write
that failed once seldom succeeds a moment later. The queue now stops on
the first store error. Submit answers that error once and ErrClosed
after, the job in hand writes nothing more to the store and keeps the
state the store last recorded, so one not yet marked sending reads as
queued again, and Run returns the error. A failure that an insert meets
while shutdown waits for it is returned too.

Every store error that stops the queue is marked ErrStoreFailed. serve
logs it once at ERROR, reports it to Sentry once and stops the daemon.
A request whose job could not be stored answers 500 internal_error
without being logged or reported again, so the failure is reported
once whoever submitted the job. docs/configuration.md lists it under
Logs.

With the memory store nothing fails, so the daemon behaves as before.
Part of 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:44:43 -06:00
1 parent 14c5e86ab6
commit 7e6cda16f8
7 files changed
+349 -45

No files matched your search

+5 -2
View File
@@ -227,8 +227,11 @@ Request bodies and the `Authorization` header are never sent to Sentry.
- An unexpected failure is logged at ERROR and reported to Sentry once: a
request that fails or panics, a job that fails after its retries
(`job failed`), a module that builds an invalid receipt, a notification
card or digest that prints its plain fallback, and an ntfy state file
that cannot be written.
card or digest that prints its plain fallback, an ntfy state file that
cannot be written, and a job store that fails (`print queue stopped`),
which stops the daemon. A request whose job it could not store answers
`500` `internal_error`; the failure is logged and reported with the
stop, not again for the request.
- Refusals are never logged at ERROR and never go to Sentry. They are the
4xx answers other than `module_failed`, the `queue_full` and
`shutting_down` 503s, and 503s from `/healthz`.