mirror of
https://github.com/restic/restic.git
synced 2026-05-28 04:35:41 -04:00
Retry logic to treat no space errors permanently
Handle local disk space errors as permanent errors in retry logic.
This commit is contained in:
parent
3962aee507
commit
2e231a6f29
1 changed files with 11 additions and 1 deletions
|
|
@ -107,7 +107,6 @@ func (be *Backend) retry(ctx context.Context, msg string, f func() error) error
|
|||
|
||||
bo := backoff.NewExponentialBackOff()
|
||||
bo.MaxElapsedTime = be.MaxElapsedTime
|
||||
|
||||
if feature.Flag.Enabled(feature.BackendErrorRedesign) {
|
||||
bo.InitialInterval = 1 * time.Second
|
||||
bo.Multiplier = 2
|
||||
|
|
@ -135,14 +134,25 @@ func (be *Backend) retry(ctx context.Context, msg string, f func() error) error
|
|||
err := retryNotifyErrorWithSuccess(
|
||||
func() error {
|
||||
err := f()
|
||||
|
||||
// Running out of local disk space is not a transient backend
|
||||
// failure. For example, `restic check` can fail while writing to a
|
||||
// temporary cache directory. Retrying only repeats the same local
|
||||
// disk-space error.
|
||||
if isNoSpaceError(err) {
|
||||
return backoff.Permanent(err)
|
||||
}
|
||||
|
||||
// don't retry permanent errors as those very likely cannot be fixed by retrying
|
||||
// TODO remove IsNotExist(err) special cases when removing the feature flag
|
||||
if feature.Flag.Enabled(feature.BackendErrorRedesign) && !errors.Is(err, &backoff.PermanentError{}) && be.Backend.IsPermanentError(err) {
|
||||
permanentErrorAttempts--
|
||||
}
|
||||
|
||||
if permanentErrorAttempts <= 0 {
|
||||
return backoff.Permanent(err)
|
||||
}
|
||||
|
||||
return err
|
||||
},
|
||||
backoff.WithContext(b, ctx),
|
||||
|
|
|
|||
Loading…
Reference in a new issue