File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -153,7 +153,9 @@ func resetIdleTicker(t *time.Ticker, dur time.Duration) {
153153
154154// doStartNewWorker starts a new worker for the queue, the worker reads from worker's channel and handles the items.
155155func (q * WorkerPoolQueue [T ]) doStartNewWorker (wp * workerGroup [T ]) {
156- & wp .wg .Go (func () {
156+ wp .wg .Add (1 )
157+ go func () {
158+ defer wp .wg .Done ()
157159 log .Debug ("Queue %q starts new worker" , q .GetName ())
158160 defer log .Debug ("Queue %q stops idle worker" , q .GetName ())
159161
@@ -188,7 +190,7 @@ func (q *WorkerPoolQueue[T]) doStartNewWorker(wp *workerGroup[T]) {
188190 q .workerNumMu .Unlock ()
189191 }
190192 }
191- })
193+ }( )
192194}
193195
194196// doFlush flushes the queue: it tries to read all items from the queue and handles them.
You can’t perform that action at this time.
0 commit comments