Leave unsent jobs queued when a durable store stops

A stop and a start are a restart too, so with a store that outlives the
process a stop now treats waiting jobs as a crash would: they stay
queued and print at the next start. The job in hand stays queued as
well while nothing of it has been sent: rendering and connecting end
with the daemon, and an attempt whose connection opens once the stop
has begun writes nothing. Only a write that has begun runs on, so the
stop takes at most printer.write_timeout and two commits. A job waiting
to retry after an attempt reached the printer fails, as before, and its
sent_at shows that bytes went out.

A store error that stops the queue now ends the job's context the same
way, so a rendering, a dial or a wait between retries stops at once
rather than running on to a job that can write nothing.

With the memory store, which the process forgets, a stop is unchanged:
the job in hand finishes, rendering included, and waiting jobs fail.

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:46:13 -06:00
1 parent 45b57ab196
commit 4ef6d21258
3 files changed
+480 -17

No files matched your search

+5
View File
@@ -88,6 +88,11 @@ func discardLogger() *slog.Logger {
return slog.New(slog.NewTextHandler(io.Discard, nil))
}
// slogTo returns a logger that writes text lines to b.
func slogTo(b *lockedBuffer) *slog.Logger {
return slog.New(slog.NewTextHandler(b, nil))
}
func newQueue(r printqueue.Renderer, s printqueue.Sender, opts printqueue.Options) *printqueue.Queue {
return newQueueOn(printqueue.NewMemoryStore(), r, s, discardLogger(), opts)
}