1
0
Fork 0
forked from forgejo/forgejo

Fix queue worker incorrectly stopped when there are still more items in the queue (#29532) (#29546)

Backport #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 86cd94cba6d63c84528f6f8d52b1ec22b44ac2f8)
This commit is contained in:
Giteabot 2024-03-03 03:40:06 +08:00 committed by Earl Warren
parent 1a65ecb867
commit 52f52f60f1
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
3 changed files with 42 additions and 9 deletions

View file

@ -40,6 +40,8 @@ type WorkerPoolQueue[T any] struct {
workerMaxNum int
workerActiveNum int
workerNumMu sync.Mutex
workerStartedCounter int32
}
type flushType chan struct{}