fix(scheduler): ignore 404 when updating job run (#5495)
This commit is contained in:
1 parent
628f3fb0c7
commit
47e314ebc2
2 files changed
+3
-3
No files matched your search
@@ -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
|
// Failed to update run, either it does not exist or was in an invalid state
|
||||||
if err = r.LookupById(ctx, run); err != nil {
|
if err = r.LookupById(ctx, run); err != nil {
|
||||||
if errors.IsNotFoundError(err) {
|
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)
|
return errors.Wrap(ctx, err, op)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -332,8 +332,8 @@ func (s *Scheduler) updateRunningJobProgress(ctx context.Context, j *runningJob)
|
|||||||
}
|
}
|
||||||
status := j.status()
|
status := j.status()
|
||||||
_, err = repo.UpdateProgress(ctx, j.runId, status.Completed, status.Total, status.Retries)
|
_, err = repo.UpdateProgress(ctx, j.runId, status.Completed, status.Total, status.Retries)
|
||||||
if errors.Match(errors.T(errors.InvalidJobRunState), err) {
|
if errors.Match(errors.T(errors.InvalidJobRunState), err) || errors.IsNotFoundError(err) {
|
||||||
// Job has been persisted with a final run status, cancel job context to trigger early exit.
|
// Job has been persisted with a final run status or deleted, cancel job context to trigger early exit.
|
||||||
j.cancelCtx()
|
j.cancelCtx()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user