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.
This commit is contained in:
repo.diff.committed_by
GitHub
repo.diff.parent
a3f05d0d98
repo.diff.commit
6465f94a2d
@@ -40,6 +40,8 @@ type WorkerPoolQueue[T any] struct {
|
||||
workerMaxNum int
|
||||
workerActiveNum int
|
||||
workerNumMu sync.Mutex
|
||||
|
||||
workerStartedCounter int32
|
||||
}
|
||||
|
||||
type flushType chan struct{}
|
||||
|
||||
Reference in New Issue
Block a user