call WaitGroup.Done() at the right time

Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Inteon 2021-07-22 17:55:34 +02:00
parent 9ad9e220f3
commit 81aa09cd88
No known key found for this signature in database
GPG Key ID: BD5DCF7303C7C1A7

View File

@ -107,12 +107,12 @@ func (c *controller) Run(workers int, stopCh <-chan struct{}) error {
var wg sync.WaitGroup
for i := 0; i < workers; i++ {
wg.Add(1)
// TODO (@munnerz): make time.Second duration configurable
go wait.Until(func() {
wg.Add(1)
go func() {
defer wg.Done()
c.worker(ctx)
}, time.Second, stopCh)
wait.Until(func() { c.worker(ctx) }, time.Second, stopCh)
}()
}
for _, f := range c.runFirstFuncs {