From 95e660f3f43ac33350039261caa927eca6cc9a7b Mon Sep 17 00:00:00 2001 From: Lynn Date: Fri, 10 Feb 2023 12:15:59 +0800 Subject: [PATCH] util/gpool/spmc: add a sleep to a simple `for` (#41240) close pingcap/tidb#41205 --- util/gpool/spmc/spmcpool.go | 1 + 1 file changed, 1 insertion(+) diff --git a/util/gpool/spmc/spmcpool.go b/util/gpool/spmc/spmcpool.go index d1a3bbb80c4aa..8afdf9db0c253 100644 --- a/util/gpool/spmc/spmcpool.go +++ b/util/gpool/spmc/spmcpool.go @@ -249,6 +249,7 @@ func (p *Pool[T, U, C, CT, TF]) ReleaseAndWait() { if p.Running() == 0 && p.heartbeatDone.Load() && p.waitingTask.Load() == 0 { return } + time.Sleep(5 * time.Millisecond) } }