Simplify workers and fix metrics

This commit is contained in:
2025-08-13 11:37:05 +03:00
parent eb0dea6113
commit 900c7ecb51
4 changed files with 29 additions and 104 deletions

View File

@@ -118,7 +118,7 @@ func (s *TranscribeService) FindAndRunConversionJob() error {
job, err := s.jobRepo.FindAndAcquire(entity.StateCreated, acquisitionId, rottingTime)
if err != nil {
if _, ok := err.(*contract.JobNotFoundError); ok {
return nil
return &contract.NoopJobError{State: entity.StateCreated}
}
return err
}
@@ -194,7 +194,7 @@ func (s *TranscribeService) FindAndRunTranscribeJob() error {
jobRecord, err := s.jobRepo.FindAndAcquire(entity.StateConverted, acquisitionId, rottingTime)
if err != nil {
if _, ok := err.(*contract.JobNotFoundError); ok {
return nil
return &contract.NoopJobError{State: entity.StateConverted}
}
return err
}
@@ -247,7 +247,7 @@ func (s *TranscribeService) FindAndRunTranscribeCheckJob() error {
job, err := s.jobRepo.FindAndAcquire(entity.StateTranscribe, acquisitionId, rottingTime)
if err != nil {
if _, ok := err.(*contract.JobNotFoundError); ok {
return nil
return &contract.NoopJobError{State: entity.StateTranscribe}
}
return fmt.Errorf("failed find and acquire job: %s, %w", entity.StateTranscribe, err)
}