From 4a48332248d878a0911df0448d6dcf1131c45760 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Mon, 31 Oct 2022 23:34:45 +0500 Subject: [PATCH] refactor error contains already deleted (#3932) --- weed/filer/filer_deletion.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/weed/filer/filer_deletion.go b/weed/filer/filer_deletion.go index c948ae713..504ee2986 100644 --- a/weed/filer/filer_deletion.go +++ b/weed/filer/filer_deletion.go @@ -1,6 +1,7 @@ package filer import ( + "github.com/seaweedfs/seaweedfs/weed/storage" "math" "strings" "time" @@ -54,7 +55,7 @@ func (f *Filer) loopProcessingDeletion() { deletionCount = len(toDeleteFileIds) _, err := operation.DeleteFilesWithLookupVolumeId(f.GrpcDialOption, toDeleteFileIds, lookupFunc) if err != nil { - if !strings.Contains(err.Error(), "already deleted") { + if !strings.Contains(err.Error(), storage.ErrorDeleted.Error()) { glog.V(0).Infof("deleting fileIds len=%d error: %v", deletionCount, err) } } else { @@ -86,7 +87,7 @@ func (f *Filer) doDeleteFileIds(fileIds []string) { deletionCount := len(toDeleteFileIds) _, err := operation.DeleteFilesWithLookupVolumeId(f.GrpcDialOption, toDeleteFileIds, lookupFunc) if err != nil { - if !strings.Contains(err.Error(), "already deleted") { + if !strings.Contains(err.Error(), storage.ErrorDeleted.Error()) { glog.V(0).Infof("deleting fileIds len=%d error: %v", deletionCount, err) } }