优化代码

This commit is contained in:
GoEdgeLab
2022-12-05 09:57:01 +08:00
parent 8b6d0bcb61
commit 194c953364

View File

@@ -770,6 +770,7 @@ func (this *FileStorage) CleanAll() error {
var dirNameReg = regexp.MustCompile(`^[0-9a-f]{2}$`) var dirNameReg = regexp.MustCompile(`^[0-9a-f]{2}$`)
for _, rootDir := range rootDirs { for _, rootDir := range rootDirs {
var dir = rootDir + "/p" + types.String(this.policy.Id) var dir = rootDir + "/p" + types.String(this.policy.Id)
err = func(dir string) error {
fp, err := os.Open(dir) fp, err := os.Open(dir)
if err != nil { if err != nil {
return err return err
@@ -815,6 +816,12 @@ func (this *FileStorage) CleanAll() error {
remotelogs.Warn("CACHE", "delete '*-deleted' dirs failed: "+err.Error()) remotelogs.Warn("CACHE", "delete '*-deleted' dirs failed: "+err.Error())
} }
}) })
return nil
}(dir)
if err != nil {
return err
}
} }
return nil return nil