From 538ed93ccd403d0a3b868f9f807981b91fda47f4 Mon Sep 17 00:00:00 2001 From: Mathias Date: Fri, 2 Oct 2026 08:53:10 +0200 Subject: [PATCH] test(uploads): a slow heartbeat write, so one is in flight when the job ends Co-Authored-By: Claude Sonnet 5.5 --- internal/uploads/worker_test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/uploads/worker_test.go b/internal/uploads/worker_test.go index 2454795..e8abbf7 100644 --- a/internal/uploads/worker_test.go +++ b/internal/uploads/worker_test.go @@ -25,6 +25,9 @@ type wStore struct { startErr error saves [][]domain.ProgressStep beats int + // beatDelay makes each heartbeat write slow, so one is still in flight when a job + // ends -- which is what proves the worker waits for its heartbeat to finish. + beatDelay time.Duration } func newWStore() *wStore { @@ -60,6 +63,7 @@ func (s *wStore) SaveProgress(_ context.Context, _, _ string, steps []domain.Pro } func (s *wStore) Heartbeat(context.Context, string, string) error { + time.Sleep(s.beatDelay) s.mu.Lock() defer s.mu.Unlock() s.beats++