mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
Merge pull request #1493 from restic/retry-delete
backend: Retry deletes
This commit is contained in:
commit
6b564d21b3
@ -74,7 +74,7 @@ func (be *RetryBackend) Save(ctx context.Context, h restic.Handle, rd io.Reader)
|
||||
}
|
||||
|
||||
debug.Log("Save(%v) failed with error, removing file: %v", h, err)
|
||||
rerr := be.Remove(ctx, h)
|
||||
rerr := be.Backend.Remove(ctx, h)
|
||||
if rerr != nil {
|
||||
debug.Log("Remove(%v) returned error: %v", h, err)
|
||||
}
|
||||
@ -110,3 +110,10 @@ func (be *RetryBackend) Stat(ctx context.Context, h restic.Handle) (fi restic.Fi
|
||||
})
|
||||
return fi, err
|
||||
}
|
||||
|
||||
// Remove removes a File with type t and name.
|
||||
func (be *RetryBackend) Remove(ctx context.Context, h restic.Handle) (err error) {
|
||||
return be.retry(ctx, fmt.Sprintf("Remove(%v)", h), func() error {
|
||||
return be.Backend.Remove(ctx, h)
|
||||
})
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ type Backend interface {
|
||||
// Test a boolean value whether a File with the name and type exists.
|
||||
Test(ctx context.Context, h Handle) (bool, error)
|
||||
|
||||
// Remove removes a File with type t and name.
|
||||
// Remove removes a File described by h.
|
||||
Remove(ctx context.Context, h Handle) error
|
||||
|
||||
// Close the backend
|
||||
|
Loading…
Reference in New Issue
Block a user