Stop Counters where they're constructed and started

This commit is contained in:
greatroar
2020-11-08 21:03:59 +01:00
parent ddca699cd2
commit 21b787a4d1
8 changed files with 7 additions and 11 deletions

View File

@@ -773,14 +773,13 @@ func checkPack(ctx context.Context, r restic.Repository, id restic.ID) error {
}
// ReadData loads all data from the repository and checks the integrity.
func (c *Checker) ReadData(ctx context.Context, p *progress.Counter, errChan chan<- error) {
c.ReadPacks(ctx, c.packs, p, errChan)
func (c *Checker) ReadData(ctx context.Context, errChan chan<- error) {
c.ReadPacks(ctx, c.packs, nil, errChan)
}
// ReadPacks loads data from specified packs and checks the integrity.
func (c *Checker) ReadPacks(ctx context.Context, packs restic.IDSet, p *progress.Counter, errChan chan<- error) {
defer close(errChan)
defer p.Done()
g, ctx := errgroup.WithContext(ctx)
ch := make(chan restic.ID)