Commit c5ecd444 authored by Steven Allen's avatar Steven Allen

fix: retry deletes

parent d174dc3d
...@@ -726,16 +726,22 @@ func (fs *Datastore) doDelete(key datastore.Key) error { ...@@ -726,16 +726,22 @@ func (fs *Datastore) doDelete(key datastore.Key) error {
fSize := fileSize(path) fSize := fileSize(path)
switch err := os.Remove(path); { var err error
case err == nil: for i := 0; i < RetryAttempts; i++ {
err = os.Remove(path)
if err == nil {
break
} else if os.IsNotExist(err) {
return nil
}
}
if err == nil {
atomic.AddInt64(&fs.diskUsage, -fSize) atomic.AddInt64(&fs.diskUsage, -fSize)
fs.checkpointDiskUsage() fs.checkpointDiskUsage()
return nil
case os.IsNotExist(err):
return nil
default:
return err
} }
return err
} }
func (fs *Datastore) Query(q query.Query) (query.Results, error) { func (fs *Datastore) Query(q query.Query) (query.Results, error) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment