Call a hook between dialling the printer and writing to it

The job store must commit a delivery's sending mark after the printer's
connection opens and before the first byte goes out, so that a job
interrupted mid-send is never sent again after a restart, while a dial
failure writes nothing. Send now takes a beforeWrite function for that
step. An error from it closes the connection with nothing written.

The write deadline is computed after beforeWrite returns, so a slow
synced commit does not use up printer.write_timeout. The queue passes
nil for now, so nothing changes in what is sent.

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 12:29:52 -06:00
1 parent 66531e7314
commit 50db21190b
4 files changed
+96 -9

No files matched your search

+1 -1
View File
@@ -31,7 +31,7 @@ type fakeSender struct {
block chan struct{} // if set, Send waits for it to close
}
func (f *fakeSender) Send(_ context.Context, data []byte) error {
func (f *fakeSender) Send(_ context.Context, data []byte, _ func() error) error {
if f.block != nil {
<-f.block
}