From 6465f94a2d26cdacc232fddc20f98d98df61ddac Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sun, 3 Mar 2024 00:07:54 +0800 Subject: Fix queue worker incorrectly stopped when there are still more items in the queue (#29532) Without `case <-t.C`, the workers would stop incorrectly, the test won't pass. For the worse case, there might be only one running worker processing the queue items for long time because other workers are stopped. The root cause is related to the logic of doDispatchBatchToWorker. It isn't a serious problem at the moment, so keep it as-is. --- modules/queue/workerqueue.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/queue/workerqueue.go') diff --git a/modules/queue/workerqueue.go b/modules/queue/workerqueue.go index b28fd88027..4160622d81 100644 --- a/modules/queue/workerqueue.go +++ b/modules/queue/workerqueue.go @@ -40,6 +40,8 @@ type WorkerPoolQueue[T any] struct { workerMaxNum int workerActiveNum int workerNumMu sync.Mutex + + workerStartedCounter int32 } type flushType chan struct{} -- cgit v1.2.3