mirror of
https://codeberg.org/forgejo/forgejo
synced 2024-11-25 19:26:09 +01:00
workergroup: gracefully exit on close(popItemErr)
This commit is contained in:
parent
fb6bcf1029
commit
639ac7a131
|
@ -334,7 +334,10 @@ func (q *WorkerPoolQueue[T]) doRun() {
|
||||||
// since we are already in a "flush" operation, so the dispatching function shouldn't read the flush chan.
|
// since we are already in a "flush" operation, so the dispatching function shouldn't read the flush chan.
|
||||||
q.doDispatchBatchToWorker(wg, skipFlushChan)
|
q.doDispatchBatchToWorker(wg, skipFlushChan)
|
||||||
q.doFlush(wg, flush)
|
q.doFlush(wg, flush)
|
||||||
case err := <-wg.popItemErr:
|
case err, errOk := <-wg.popItemErr:
|
||||||
|
if !errOk {
|
||||||
|
return
|
||||||
|
}
|
||||||
if !q.isCtxRunCanceled() {
|
if !q.isCtxRunCanceled() {
|
||||||
log.Error("Failed to pop item from queue %q (doRun): %v", q.GetName(), err)
|
log.Error("Failed to pop item from queue %q (doRun): %v", q.GetName(), err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue