mirror of
https://github.com/restic/restic.git
synced 2025-08-23 09:37:40 +00:00
retry: Do not retry Stat() if file does not exist
In non test/debug code, Stat() is used exclusively to check whether a file exists. Thus, do not retry if a file is reported as not existing.
This commit is contained in:
@@ -139,6 +139,10 @@ func (be *Backend) Stat(ctx context.Context, h restic.Handle) (fi restic.FileInf
|
||||
var innerError error
|
||||
fi, innerError = be.Backend.Stat(ctx, h)
|
||||
|
||||
if be.Backend.IsNotExist(innerError) {
|
||||
// do not retry if file is not found, as stat is usually used to check whether a file exists
|
||||
return backoff.Permanent(innerError)
|
||||
}
|
||||
return innerError
|
||||
})
|
||||
return fi, err
|
||||
|
Reference in New Issue
Block a user