From 2f6102a0c0fba658ef664f44af5e65b007930033 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Mon, 5 Jul 2021 23:54:50 +0200 Subject: batcher: do not pass struct fields --- skate/zipkey/batch.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'skate/zipkey') diff --git a/skate/zipkey/batch.go b/skate/zipkey/batch.go index c31909c..9e52f90 100644 --- a/skate/zipkey/batch.go +++ b/skate/zipkey/batch.go @@ -27,7 +27,7 @@ func NewBatcher(gf groupFunc) *Batcher { } for i := 0; i < batcher.NumWorkers; i++ { batcher.wg.Add(1) - go batcher.worker(batcher.queue, &batcher.wg) + go batcher.worker() } return &batcher } @@ -59,10 +59,10 @@ func (b *Batcher) GroupFunc(g *Group) error { } // worker will wind down after a first error encountered. -func (b *Batcher) worker(queue chan []*Group, wg *sync.WaitGroup) { - defer wg.Done() +func (b *Batcher) worker() { + defer b.wg.Done() OUTER: - for batch := range queue { + for batch := range b.queue { for _, g := range batch { if err := b.gf(g); err != nil { b.err = err -- cgit v1.2.3