Merge pull request #1493 from restic/retry-delete

backend: Retry deletes
This commit is contained in:
Alexander Neumann 2017-12-23 11:53:09 +01:00
commit 6b564d21b3
2 changed files with 9 additions and 2 deletions

View File

@ -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)
})
}

View File

@ -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