defer Done call

safer in case of panic
This commit is contained in:
Alexander Zielenski 2022-12-15 13:09:11 -08:00
parent 8c23f06aaa
commit 517df8f305

View File

@ -185,8 +185,8 @@ func (c *controller[T]) Run(ctx context.Context) error {
for i := uint(0); i < c.options.Workers; i++ {
waitGroup.Add(1)
go func() {
defer waitGroup.Done()
wait.Until(c.runWorker, time.Second, ctx.Done())
waitGroup.Done()
}()
}