debug: fix crash in `debug examine --reupload-blobs`

This commit is contained in:
Michael Eischer 2022-11-09 22:13:17 +01:00
parent 24a2e5cab9
commit 11a4bb051e
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 {