debug: fix crash in debug examine --reupload-blobs
This commit is contained in:
parent
24a2e5cab9
commit
11a4bb051e
1 changed files with 73 additions and 66 deletions
|
@ -325,6 +325,14 @@ func loadBlobs(ctx context.Context, repo restic.Repository, packID restic.ID, li
|
||||||
Name: packID.String(),
|
Name: packID.String(),
|
||||||
Type: restic.PackFile,
|
Type: restic.PackFile,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wg, ctx := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
|
if reuploadBlobs {
|
||||||
|
repo.StartPackUploader(ctx, wg)
|
||||||
|
}
|
||||||
|
|
||||||
|
wg.Go(func() error {
|
||||||
for _, blob := range list {
|
for _, blob := range list {
|
||||||
Printf(" loading blob %v at %v (length %v)\n", blob.ID, blob.Offset, blob.Length)
|
Printf(" loading blob %v at %v (length %v)\n", blob.ID, blob.Offset, blob.Length)
|
||||||
buf := make([]byte, 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 {
|
if reuploadBlobs {
|
||||||
err := repo.Flush(ctx)
|
return repo.Flush(ctx)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
return wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
func storePlainBlob(id restic.ID, prefix string, plain []byte) error {
|
func storePlainBlob(id restic.ID, prefix string, plain []byte) error {
|
||||||
|
|
Loading…
Reference in a new issue