fix(scheduler): ignore 404 when updating job run (#5495)

pull/5499/head
Louis Ruch 1 year ago committed by GitHub
parent 628f3fb0c7
commit 47e314ebc2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -93,7 +93,7 @@ func (r *Repository) UpdateProgress(ctx context.Context, runId string, completed
// Failed to update run, either it does not exist or was in an invalid state
if err = r.LookupById(ctx, run); err != nil {
if errors.IsNotFoundError(err) {
return errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("job run %q does not exist", runId)))
return errors.Wrap(ctx, err, op, errors.WithMsg(fmt.Sprintf("job run %q does not exist", runId)), errors.WithoutEvent())
}
return errors.Wrap(ctx, err, op)
}

@ -332,8 +332,8 @@ func (s *Scheduler) updateRunningJobProgress(ctx context.Context, j *runningJob)
}
status := j.status()
_, err = repo.UpdateProgress(ctx, j.runId, status.Completed, status.Total, status.Retries)
if errors.Match(errors.T(errors.InvalidJobRunState), err) {
// Job has been persisted with a final run status, cancel job context to trigger early exit.
if errors.Match(errors.T(errors.InvalidJobRunState), err) || errors.IsNotFoundError(err) {
// Job has been persisted with a final run status or deleted, cancel job context to trigger early exit.
j.cancelCtx()
return nil
}

Loading…
Cancel
Save