aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-07-05 23:54:50 +0200
committerMartin Czygan <martin.czygan@gmail.com>2021-07-05 23:54:50 +0200
commit2f6102a0c0fba658ef664f44af5e65b007930033 (patch)
treef91d1ffdd4e6056ada3ef1dbb667fcc39fc64faf
parentc5342e90974c7b857b462b06afdcbd3498a1bcf4 (diff)
downloadrefcat-2f6102a0c0fba658ef664f44af5e65b007930033.tar.gz
refcat-2f6102a0c0fba658ef664f44af5e65b007930033.zip
batcher: do not pass struct fields
-rw-r--r--skate/zipkey/batch.go8
1 files changed, 4 insertions, 4 deletions
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