forked from forgejo/forgejo
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. (cherry picked from commit 6465f94a2d26cdacc232fddc20f98d98df61ddac)
This commit is contained in:
parent
e2371743d5
commit
e159297443
3 changed files with 42 additions and 9 deletions
|
@ -40,6 +40,8 @@ type WorkerPoolQueue[T any] struct {
|
|||
workerMaxNum int
|
||||
workerActiveNum int
|
||||
workerNumMu sync.Mutex
|
||||
|
||||
workerStartedCounter int32
|
||||
}
|
||||
|
||||
type flushType chan struct{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue