test(uploads): a slow heartbeat write, so one is in flight when the job ends

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-02 08:53:10 +02:00
co-authored by Claude Sonnet 5.5
parent 27a88a0a1f
commit 538ed93ccd
+4
View File
@@ -25,6 +25,9 @@ type wStore struct {
startErr error startErr error
saves [][]domain.ProgressStep saves [][]domain.ProgressStep
beats int 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 { 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 { func (s *wStore) Heartbeat(context.Context, string, string) error {
time.Sleep(s.beatDelay)
s.mu.Lock() s.mu.Lock()
defer s.mu.Unlock() defer s.mu.Unlock()
s.beats++ s.beats++