From b29e662fcc9b98212af202fae15f668d36732fcd Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Tue, 3 Jan 2023 18:09:46 +0800 Subject: [PATCH] simple code Signed-off-by: Weizhen Wang --- util/gpool/spmc/spmcpool.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/util/gpool/spmc/spmcpool.go b/util/gpool/spmc/spmcpool.go index a81f423ab8564..b69c7a05e0eca 100644 --- a/util/gpool/spmc/spmcpool.go +++ b/util/gpool/spmc/spmcpool.go @@ -392,10 +392,7 @@ func (p *Pool[T, U, C, CT, TF]) retrieveWorker() (w *goWorker[T, U, C, CT, TF]) // revertWorker puts a worker back into free pool, recycling the goroutines. func (p *Pool[T, U, C, CT, TF]) revertWorker(worker *goWorker[T, U, C, CT, TF]) bool { - if capacity := p.Cap(); capacity > 0 && p.Running() > capacity && p.waitingTask.Load() == 0 { - return true - } - if p.IsClosed() { + if capacity := p.Cap(); capacity > 0 && p.Running() > capacity || p.IsClosed() { p.cond.Broadcast() return false }