mirror of
https://github.com/restic/restic.git
synced 2025-08-23 06:17:42 +00:00
Stop Counters where they're constructed and started
This commit is contained in:
@@ -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)
|
||||
|
@@ -50,7 +50,7 @@ func checkData(chkr *checker.Checker) []error {
|
||||
return collectErrors(
|
||||
context.TODO(),
|
||||
func(ctx context.Context, errCh chan<- error) {
|
||||
chkr.ReadData(ctx, nil, errCh)
|
||||
chkr.ReadData(ctx, errCh)
|
||||
},
|
||||
)
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ func TestCheckRepo(t testing.TB, repo restic.Repository) {
|
||||
|
||||
// read data
|
||||
errChan = make(chan error)
|
||||
go chkr.ReadData(context.TODO(), nil, errChan)
|
||||
go chkr.ReadData(context.TODO(), errChan)
|
||||
|
||||
for err := range errChan {
|
||||
t.Error(err)
|
||||
|
Reference in New Issue
Block a user