ref: fcfa6f33bbebc128a3f9bc3162173bc3780c5f50
parent: 77b23fe3db9ff86216887c317249a9a7e990139f
author: Bjørn Erik Pedersen <[email protected]>
date: Thu Sep 12 13:24:34 EDT 2019
filecache: Ignore "does not exist" errors in prune Fixes #6326 Fixes #5745
--- a/cache/filecache/filecache_pruner.go
+++ b/cache/filecache/filecache_pruner.go
@@ -31,12 +31,15 @@
count, err := cache.Prune(false)
+ counter += count
+
if err != nil {
+ if os.IsNotExist(err) {
+ continue
+ }
return counter, errors.Wrapf(err, "failed to prune cache %q", k)
}
- counter += count
-
}
return counter, nil
@@ -68,9 +71,13 @@
_, err = f.Readdirnames(1)
if err == io.EOF {
// Empty dir.
- return c.Fs.Remove(name)
+ err = c.Fs.Remove(name)
}
+ if err != nil && !os.IsNotExist(err) {
+ return err
+ }
+
return nil
}
@@ -87,7 +94,11 @@
if err == nil {
counter++
}
- return err
+
+ if err != nil && !os.IsNotExist(err) {
+ return err
+ }
+
}
return nil