defer close(ch) outside repository.RunWorkers

This commit is contained in:
greatroar
2020-10-14 14:23:06 +02:00
parent 6003dada14
commit b27375f5ce
3 changed files with 7 additions and 24 deletions

View File

@@ -135,14 +135,10 @@ func (c *Checker) LoadIndex(ctx context.Context) (hints []error, errs []error) {
return nil
}
// final closes indexCh after all workers have terminated
final := func() {
close(resultCh)
}
// run workers on ch
wg.Go(func() error {
return repository.RunWorkers(defaultParallelism, worker, final)
defer close(resultCh)
return repository.RunWorkers(defaultParallelism, worker)
})
// receive decoded indexes