workergroup: gracefully exit on close(popItemErr)

This commit is contained in:
oliverpool 2024-03-19 16:24:28 +01:00
parent fb6bcf1029
commit 639ac7a131

View file

@ -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.
q.doDispatchBatchToWorker(wg, skipFlushChan)
q.doFlush(wg, flush)
case err := <-wg.popItemErr:
case err, errOk := <-wg.popItemErr:
if !errOk {
return
}
if !q.isCtxRunCanceled() {
log.Error("Failed to pop item from queue %q (doRun): %v", q.GetName(), err)
}