repository: Add blob loading fallback to LoadBlobsFromPack

Try to retrieve individual blobs via LoadBlob if streaming did not work.
This commit is contained in:
Michael Eischer
2023-12-31 15:27:36 +01:00
parent 228b35f074
commit 621012dac0
3 changed files with 109 additions and 21 deletions

View File

@@ -79,13 +79,8 @@ func repack(ctx context.Context, repo restic.Repository, dstRepo restic.Reposito
for t := range downloadQueue {
err := repo.LoadBlobsFromPack(wgCtx, t.PackID, t.Blobs, func(blob restic.BlobHandle, buf []byte, err error) error {
if err != nil {
var ierr error
// check whether we can get a valid copy somewhere else
buf, ierr = repo.LoadBlob(wgCtx, blob.Type, blob.ID, nil)
if ierr != nil {
// no luck, return the original error
return err
}
// a required blob couldn't be retrieved
return err
}
keepMutex.Lock()