From b11344aa27880d4140470d946a2b47ff1063030a Mon Sep 17 00:00:00 2001 From: zzy987 <67889264+zzy987@users.noreply.github.com> Date: Tue, 24 Aug 2021 15:18:55 +0800 Subject: [PATCH] fix: use getTask instead of taskStore.Get, for the error cause type (#571) Signed-off-by: zzy987 <67889264+zzy987@users.noreply.github.com> --- cdnsystem/supervisor/cdn/storage/storage_gc.go | 5 +---- cdnsystem/supervisor/task/manager.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cdnsystem/supervisor/cdn/storage/storage_gc.go b/cdnsystem/supervisor/cdn/storage/storage_gc.go index 7d086de78..6938f3ad4 100644 --- a/cdnsystem/supervisor/cdn/storage/storage_gc.go +++ b/cdnsystem/supervisor/cdn/storage/storage_gc.go @@ -100,10 +100,7 @@ func (cleaner *Cleaner) GC(storagePattern string, force bool) ([]string, error) walkTaskIds[taskID] = true // we should return directly when we success to get info which means it is being used - if _, err := cleaner.taskMgr.Get(taskID); err == nil || !cdnerrors.IsDataNotFound(err) { - if err != nil { - logger.GcLogger.With("type", storagePattern).Errorf("failed to get taskID(%s): %v", taskID, err) - } + if cleaner.taskMgr.Exist(taskID) { return nil } diff --git a/cdnsystem/supervisor/task/manager.go b/cdnsystem/supervisor/task/manager.go index 538feb952..d9be8db2f 100644 --- a/cdnsystem/supervisor/task/manager.go +++ b/cdnsystem/supervisor/task/manager.go @@ -182,7 +182,7 @@ func (tm Manager) Get(taskID string) (*types.SeedTask, error) { } func (tm Manager) Exist(taskID string) bool { - _, err := tm.taskStore.Get(taskID) + _, err := tm.getTask(taskID) return err == nil || !cdnerrors.IsDataNotFound(err) }