2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-27 07:16:40 +00:00

repository: clean cache between CheckPack retries

The cache cleanup pattern is also used in ListPack etc.
This commit is contained in:
Michael Eischer 2024-05-10 17:49:32 +02:00
parent 3d2410ed50
commit 673496b091

View File

@ -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 {
err := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
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
err2 := checkPackInner(ctx, r, id, blobs, size, bufRd, dec)
if err2 != nil {