mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-25 03:35:21 +01:00
fix: update the execution sweep sql to resolve the exec deletion conflict (#20603)
fix: update the execution sweep sql to resolve the exec deleteion conflict Resolve the execution deleteion conflict when there are tasks still referenced by the execution, remained execs can wait for next sweep cycle. Signed-off-by: chlins <chlins.zhang@gmail.com> Co-authored-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
793dc54aec
commit
df4ab856c7
@ -176,7 +176,7 @@ func (sm *sweepManager) Clean(ctx context.Context, execIDs []int64) error {
|
|||||||
return errors.Wrap(err, "failed to delete tasks")
|
return errors.Wrap(err, "failed to delete tasks")
|
||||||
}
|
}
|
||||||
// delete executions
|
// delete executions
|
||||||
sql = fmt.Sprintf("DELETE FROM execution WHERE id IN (%s)", orm.ParamPlaceholderForIn(len(params)))
|
sql = fmt.Sprintf("DELETE FROM execution WHERE id IN (%s) AND id NOT IN (SELECT DISTINCT execution_id FROM task)", orm.ParamPlaceholderForIn(len(params)))
|
||||||
_, err = ormer.Raw(sql, params...).Exec()
|
_, err = ormer.Raw(sql, params...).Exec()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "failed to delete executions")
|
return errors.Wrap(err, "failed to delete executions")
|
||||||
|
Loading…
Reference in New Issue
Block a user