2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-26 14:56:29 +00:00

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

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 {