mirror of
https://github.com/octoleo/restic.git
synced 2024-11-23 05:12:10 +00:00
Merge pull request #5047 from damoclark/patch-1
cache: fix race condition in cache cleanup or similar.
This commit is contained in:
commit
4105e4a356
7
changelog/unreleased/pull-5047
Normal file
7
changelog/unreleased/pull-5047
Normal file
@ -0,0 +1,7 @@
|
||||
Bugfix: Fix possible error on concurrent cache cleanup
|
||||
|
||||
Fix for multiple restic processes executing concurrently and racing to
|
||||
remove obsolete snapshots from the local backend cache. Restic now suppresses the `no
|
||||
such file or directory` error.
|
||||
|
||||
https://github.com/restic/restic/pull/5047
|
4
internal/backend/cache/file.go
vendored
4
internal/backend/cache/file.go
vendored
@ -210,6 +210,10 @@ func (c *Cache) list(t restic.FileType) (restic.IDSet, error) {
|
||||
dir := filepath.Join(c.path, cacheLayoutPaths[t])
|
||||
err := filepath.Walk(dir, func(name string, fi os.FileInfo, err error) error {
|
||||
if err != nil {
|
||||
// ignore ErrNotExist to gracefully handle multiple processes clearing the cache
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
return nil
|
||||
}
|
||||
return errors.Wrap(err, "Walk")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user