mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 10:15:35 +01:00
Merge pull request #14155 from ywk253100/210203_sweeper
Ignore the not found error in some cases
This commit is contained in:
commit
c45adabf5d
@ -167,8 +167,11 @@ func (e *executionManager) sweep(ctx context.Context, vendorType string, vendorI
|
||||
continue
|
||||
}
|
||||
if err = e.Delete(ctx, execution.ID); err != nil {
|
||||
// the execution may be deleted by the other sweep operation, ignore the not found error
|
||||
if errors.IsNotFoundErr(err) {
|
||||
continue
|
||||
}
|
||||
log.Errorf("failed to delete the execution %d: %v", execution.ID, err)
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -314,6 +317,11 @@ func (e *executionManager) Delete(ctx context.Context, id int64) error {
|
||||
WithMessage("the execution %d has tasks that aren't in final status, stop the tasks first", id)
|
||||
}
|
||||
if err = e.taskDAO.Delete(ctx, task.ID); err != nil {
|
||||
// the tasks may be deleted by the other execution deletion operation in the same time(e.g. execution sweeper),
|
||||
// ignore the not found error for the tasks
|
||||
if errors.IsNotFoundErr(err) {
|
||||
continue
|
||||
}
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user