fixed 清理过期协程报错 #7

This commit is contained in:
andy pan 2018-08-08 17:22:40 +08:00
parent 7a2f4e4681
commit 62fc58f047
2 changed files with 2 additions and 2 deletions

View File

@ -75,8 +75,8 @@ func (p *Pool) periodicallyPurge() {
w.task <- nil w.task <- nil
idleWorkers[i] = nil idleWorkers[i] = nil
} }
if n > 0 {
n++ n++
if n > 0 {
p.workers = idleWorkers[n:] p.workers = idleWorkers[n:]
} }
p.lock.Unlock() p.lock.Unlock()

View File

@ -77,8 +77,8 @@ func (p *PoolWithFunc) periodicallyPurge() {
w.args <- nil w.args <- nil
idleWorkers[i] = nil idleWorkers[i] = nil
} }
if n > 0 {
n++ n++
if n > 0 {
p.workers = idleWorkers[n:] p.workers = idleWorkers[n:]
} }
p.lock.Unlock() p.lock.Unlock()