mirror of
https://github.com/restic/restic.git
synced 2026-02-03 04:20:45 -05:00
repository: set progress bar maximum in Repack
This commit is contained in:
parent
b2afccbd96
commit
a0925fa922
3 changed files with 2 additions and 4 deletions
|
|
@ -243,9 +243,7 @@ func copyTree(ctx context.Context, srcRepo restic.Repository, dstRepo restic.Rep
|
|||
}
|
||||
|
||||
bar := printer.NewCounter("packs copied")
|
||||
bar.SetMax(uint64(len(packList)))
|
||||
err = repository.Repack(ctx, srcRepo, dstRepo, packList, copyBlobs, bar, printer.P)
|
||||
bar.Done()
|
||||
if err != nil {
|
||||
return errors.Fatalf("%s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -563,9 +563,7 @@ func (plan *PrunePlan) Execute(ctx context.Context, printer progress.Printer) er
|
|||
if len(plan.repackPacks) != 0 {
|
||||
printer.P("repacking packs\n")
|
||||
bar := printer.NewCounter("packs repacked")
|
||||
bar.SetMax(uint64(len(plan.repackPacks)))
|
||||
err := Repack(ctx, repo, repo, plan.repackPacks, plan.keepBlobs, bar, printer.P)
|
||||
bar.Done()
|
||||
if err != nil {
|
||||
return errors.Fatalf("%s", err)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,8 @@ func Repack(
|
|||
if logf == nil {
|
||||
logf = func(_ string, _ ...interface{}) {}
|
||||
}
|
||||
p.SetMax(uint64(len(packs)))
|
||||
defer p.Done()
|
||||
|
||||
if repo == dstRepo && dstRepo.Connections() < 2 {
|
||||
return errors.New("repack step requires a backend connection limit of at least two")
|
||||
|
|
|
|||
Loading…
Reference in a new issue