This commit is contained in:
Andy Pan 2018-07-06 20:20:18 +08:00
parent afba560448
commit 339aaa4475
2 changed files with 3 additions and 1 deletions

View File

@ -76,9 +76,10 @@ func (p *Pool) monitorAndClear() {
n = i n = i
w.stop() w.stop()
idleWorkers[i] = nil idleWorkers[i] = nil
p.running--
} }
if n > 0 { if n > 0 {
n += 1 n++
p.workers = idleWorkers[n:] p.workers = idleWorkers[n:]
} }
p.lock.Unlock() p.lock.Unlock()

View File

@ -77,6 +77,7 @@ func (p *PoolWithFunc) MonitorAndClear() {
n = i n = i
w.stop() w.stop()
idleWorkers[i] = nil idleWorkers[i] = nil
p.running--
} }
if n > 0 { if n > 0 {
n += 1 n += 1