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:
@@ -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++
|
||||||
|
|||||||
Reference in New Issue
Block a user