mirror of
https://github.com/gohugoio/hugo.git
synced 2024-12-27 21:32:21 +00:00
filecache: Ignore "does not exist" errors in prune
Fixes #6326 Fixes #5745
This commit is contained in:
parent
77b23fe3db
commit
fcfa6f33bb
1 changed files with 15 additions and 4 deletions
19
cache/filecache/filecache_pruner.go
vendored
19
cache/filecache/filecache_pruner.go
vendored
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue