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:
parent
40ac678252
commit
648edeca40
2 changed files with 30 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue