From 0d44d9a2acde69391c7290d31d5eba6ab476284c Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Wed, 3 Feb 2021 20:26:50 +0800 Subject: [PATCH] Ignore the not found error in some cases Ignore the not found error in some cases Fixes #14154 Signed-off-by: Wenkai Yin --- src/pkg/task/execution.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pkg/task/execution.go b/src/pkg/task/execution.go index 39b9ee4e5..35b8ced2d 100644 --- a/src/pkg/task/execution.go +++ b/src/pkg/task/execution.go @@ -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 } }