mirror of
https://github.com/octoleo/restic.git
synced 2024-11-22 21:05:10 +00:00
prune: Cleanup progress bar handling while repacking
This commit is contained in:
parent
04f79b9642
commit
05116e4787
@ -262,13 +262,11 @@ func pruneRepository(gopts GlobalOptions, repo restic.Repository) error {
|
|||||||
|
|
||||||
var obsoletePacks restic.IDSet
|
var obsoletePacks restic.IDSet
|
||||||
if len(rewritePacks) != 0 {
|
if len(rewritePacks) != 0 {
|
||||||
bar = newProgressMax(!gopts.Quiet, uint64(len(rewritePacks)), "packs rewritten")
|
bar := newProgressMax(!gopts.Quiet, uint64(len(rewritePacks)), "packs rewritten")
|
||||||
bar.Start()
|
|
||||||
obsoletePacks, err = repository.Repack(ctx, repo, rewritePacks, usedBlobs, bar)
|
obsoletePacks, err = repository.Repack(ctx, repo, rewritePacks, usedBlobs, bar)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
bar.Done()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
removePacks.Merge(obsoletePacks)
|
removePacks.Merge(obsoletePacks)
|
||||||
|
@ -17,6 +17,11 @@ import (
|
|||||||
// into a new pack. Returned is the list of obsolete packs which can then
|
// into a new pack. Returned is the list of obsolete packs which can then
|
||||||
// be removed.
|
// be removed.
|
||||||
func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, keepBlobs restic.BlobSet, p *restic.Progress) (obsoletePacks restic.IDSet, err error) {
|
func Repack(ctx context.Context, repo restic.Repository, packs restic.IDSet, keepBlobs restic.BlobSet, p *restic.Progress) (obsoletePacks restic.IDSet, err error) {
|
||||||
|
if p != nil {
|
||||||
|
p.Start()
|
||||||
|
defer p.Done()
|
||||||
|
}
|
||||||
|
|
||||||
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))
|
||||||
|
|
||||||
for packID := range packs {
|
for packID := range packs {
|
||||||
|
Loading…
Reference in New Issue
Block a user