mirror of
https://github.com/octoleo/restic.git
synced 2024-11-26 06:46:34 +00:00
Fix #3062
This commit is contained in:
parent
a5592e83f7
commit
aaf1c44362
@ -30,7 +30,7 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
|
|||||||
|
|
||||||
debug.Log("repacking %d packs while keeping %d blobs", len(packs), len(keepBlobs))
|
debug.Log("repacking %d packs while keeping %d blobs", len(packs), len(keepBlobs))
|
||||||
|
|
||||||
wg, ctx := errgroup.WithContext(ctx)
|
wg, wgCtx := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
downloadQueue := make(chan restic.ID)
|
downloadQueue := make(chan restic.ID)
|
||||||
wg.Go(func() error {
|
wg.Go(func() error {
|
||||||
@ -38,8 +38,8 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
|
|||||||
for packID := range packs {
|
for packID := range packs {
|
||||||
select {
|
select {
|
||||||
case downloadQueue <- packID:
|
case downloadQueue <- packID:
|
||||||
case <-ctx.Done():
|
case <-wgCtx.Done():
|
||||||
return ctx.Err()
|
return wgCtx.Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -60,7 +60,7 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
|
|||||||
// load the complete pack into a temp file
|
// load the complete pack into a temp file
|
||||||
h := restic.Handle{Type: restic.PackFile, Name: packID.String()}
|
h := restic.Handle{Type: restic.PackFile, Name: packID.String()}
|
||||||
|
|
||||||
tempfile, hash, packLength, err := DownloadAndHash(ctx, repo.Backend(), h)
|
tempfile, hash, packLength, err := DownloadAndHash(wgCtx, repo.Backend(), h)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "Repack")
|
return errors.Wrap(err, "Repack")
|
||||||
}
|
}
|
||||||
@ -73,8 +73,8 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
|
|||||||
|
|
||||||
select {
|
select {
|
||||||
case processQueue <- repackJob{tempfile, hash, packLength}:
|
case processQueue <- repackJob{tempfile, hash, packLength}:
|
||||||
case <-ctx.Done():
|
case <-wgCtx.Done():
|
||||||
return ctx.Err()
|
return wgCtx.Err()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
@ -157,7 +157,7 @@ func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, kee
|
|||||||
}
|
}
|
||||||
|
|
||||||
// We do want to save already saved blobs!
|
// We do want to save already saved blobs!
|
||||||
_, _, err = repo.SaveBlob(ctx, entry.Type, plaintext, entry.ID, true)
|
_, _, err = repo.SaveBlob(wgCtx, entry.Type, plaintext, entry.ID, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user