test(uploads): the worker's store double records progress saves and heartbeats
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -23,6 +23,8 @@ type wStore struct {
|
||||
completed map[string]domain.Transcription
|
||||
failed map[string]domain.UploadErrorKind
|
||||
startErr error
|
||||
saves [][]domain.ProgressStep
|
||||
beats int
|
||||
}
|
||||
|
||||
func newWStore() *wStore {
|
||||
@@ -50,6 +52,35 @@ func (s *wStore) FailUpload(_ context.Context, _, id string, k domain.UploadErro
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *wStore) SaveProgress(_ context.Context, _, _ string, steps []domain.ProgressStep, _ time.Time) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.saves = append(s.saves, append([]domain.ProgressStep(nil), steps...))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *wStore) Heartbeat(context.Context, string, string) error {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
s.beats++
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *wStore) lastSteps() []domain.ProgressStep {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
if len(s.saves) == 0 {
|
||||
return nil
|
||||
}
|
||||
return s.saves[len(s.saves)-1]
|
||||
}
|
||||
|
||||
func (s *wStore) beatCount() int {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
return s.beats
|
||||
}
|
||||
|
||||
func (s *wStore) snapshot() (map[string]domain.Transcription, map[string]domain.UploadErrorKind) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
||||
Reference in New Issue
Block a user