Merge pull request #4014 from MichaelEischer/fix-debug-examine

debug: fix crash in `debug examine --reupload-blobs`
This commit is contained in:
Michael Eischer 2022-11-10 20:37:32 +01:00 committed by GitHub
commit d268552a0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 73 additions and 66 deletions

View File

@ -325,6 +325,14 @@ func loadBlobs(ctx context.Context, repo restic.Repository, packID restic.ID, li
Name: packID.String(),
Type: restic.PackFile,
}
wg, ctx := errgroup.WithContext(ctx)
if reuploadBlobs {
repo.StartPackUploader(ctx, wg)
}
wg.Go(func() error {
for _, blob := range list {
Printf(" loading blob %v at %v (length %v)\n", blob.ID, blob.Offset, blob.Length)
buf := make([]byte, blob.Length)
@ -399,13 +407,12 @@ func loadBlobs(ctx context.Context, repo restic.Repository, packID restic.ID, li
}
if reuploadBlobs {
err := repo.Flush(ctx)
if err != nil {
return err
return repo.Flush(ctx)
}
}
return nil
})
return wg.Wait()
}
func storePlainBlob(id restic.ID, prefix string, plain []byte) error {