Skip to content
Permalink
Browse files

filecache: Ignore "does not exist" errors in prune

Fixes #6326
Fixes #5745
  • Loading branch information...
bep committed Sep 12, 2019
1 parent 77b23fe commit fcfa6f33bbebc128a3f9bc3162173bc3780c5f50
Showing with 15 additions and 4 deletions.
  1. +15 −4 cache/filecache/filecache_pruner.go
@@ -31,12 +31,15 @@ func (c Caches) Prune() (int, error) {

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,7 +71,11 @@ func (c *Cache) Prune(force bool) (int, error) {
_, 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 @@ func (c *Cache) Prune(force bool) (int, error) {
if err == nil {
counter++
}
return err

if err != nil && !os.IsNotExist(err) {
return err
}

}

return nil

0 comments on commit fcfa6f3

Please sign in to comment.
You can’t perform that action at this time.