Improve atomic delete
skip hidden directories in load task, and return soon if path not exist in atomicDelete carry of #3233 Closes #3233 Signed-off-by: Ace-Tang <aceapril@126.com> Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -179,6 +179,9 @@ func atomicDelete(path string) error {
|
||||
// create a hidden dir for an atomic removal
|
||||
atomicPath := filepath.Join(filepath.Dir(path), fmt.Sprintf(".%s", filepath.Base(path)))
|
||||
if err := os.Rename(path, atomicPath); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
return os.RemoveAll(atomicPath)
|
||||
|
Reference in New Issue
Block a user