mirror of
https://github.com/restic/restic.git
synced 2025-02-13 01:45:47 +00:00
repository: clean cache between CheckPack retries
The cache cleanup pattern is also used in ListPack etc.
This commit is contained in:
parent
3d2410ed50
commit
673496b091
1 changed files with 5 additions and 0 deletions
|
@ -40,6 +40,11 @@ func (e *partialReadError) Error() string {
|
||||||
func CheckPack(ctx context.Context, r *Repository, id restic.ID, blobs []restic.Blob, size int64, bufRd *bufio.Reader, dec *zstd.Decoder) error {
|
func CheckPack(ctx context.Context, r *Repository, id restic.ID, blobs []restic.Blob, size int64, bufRd *bufio.Reader, dec *zstd.Decoder) error {
|
||||||
err := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
|
err := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if r.Cache != nil {
|
||||||
|
// ignore error as there's not much we can do here
|
||||||
|
_ = r.Cache.Forget(backend.Handle{Type: restic.PackFile, Name: id.String()})
|
||||||
|
}
|
||||||
|
|
||||||
// retry pack verification to detect transient errors
|
// retry pack verification to detect transient errors
|
||||||
err2 := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
|
err2 := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
|
||||||
if err2 != nil {
|
if err2 != nil {
|
||||||
|
|
Loading…
Reference in a new issue