From 132f46b0476969b63896143043a3eb275cc17f2f Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 16:45:25 +0200 Subject: [PATCH] feat(uploads): the job carries the duration the file claimed (review F2) Co-Authored-By: Claude Sonnet 5.5 --- internal/uploads/intake.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/uploads/intake.go b/internal/uploads/intake.go index 56249b7..ebc8b19 100644 --- a/internal/uploads/intake.go +++ b/internal/uploads/intake.go @@ -6,6 +6,7 @@ import ( "fmt" "io" "os" + "time" "git.d-ma.be/mathias/tapir/internal/domain" ) @@ -33,6 +34,9 @@ type Job struct { UserID string UploadID string Path string + // Duration is what the file CLAIMED when probed. The worker compares it with what + // was really converted; zero means unknown (ADR-035 review). + Duration time.Duration } // Submitter hands accepted jobs to the in-process worker (ADR-033). @@ -103,7 +107,7 @@ func (in *Intake) Accept(ctx context.Context, userID, title string, src io.Reade if err != nil { return "", fmt.Errorf("uploads: create: %w", err) } - if err := in.sub.Submit(Job{UserID: userID, UploadID: id, Path: path}); err != nil { + if err := in.sub.Submit(Job{UserID: userID, UploadID: id, Path: path, Duration: probe.Duration}); err != nil { // A row that will never run must not sit queued: that is the stuck spinner. if ferr := in.store.FailUpload(ctx, userID, id, domain.UploadErrInterrupted); ferr != nil { return "", fmt.Errorf("uploads: submit: %w (and failing the row: %v)", err, ferr)