From 339aaa44752f9ffd7679720ce8f14fa5a770408a Mon Sep 17 00:00:00 2001 From: Andy Pan Date: Fri, 6 Jul 2018 20:20:18 +0800 Subject: [PATCH] update --- pool.go | 3 ++- pool_func.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pool.go b/pool.go index 9184c24..38fe397 100644 --- a/pool.go +++ b/pool.go @@ -76,9 +76,10 @@ func (p *Pool) monitorAndClear() { n = i w.stop() idleWorkers[i] = nil + p.running-- } if n > 0 { - n += 1 + n++ p.workers = idleWorkers[n:] } p.lock.Unlock() diff --git a/pool_func.go b/pool_func.go index 439b0fe..485ebe1 100644 --- a/pool_func.go +++ b/pool_func.go @@ -77,6 +77,7 @@ func (p *PoolWithFunc) MonitorAndClear() { n = i w.stop() idleWorkers[i] = nil + p.running-- } if n > 0 { n += 1