This commit is contained in:
andy pan 2018-08-08 18:13:50 +08:00
parent e99d428a5f
commit 50918eb4a9
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func (p *Pool) periodicallyPurge() {
}
n++
if n > 0 {
if n >= cap(idleWorkers) {
if n >= len(idleWorkers) {
p.workers = idleWorkers[:0]
} else {
p.workers = idleWorkers[n:]

View File

@ -79,7 +79,7 @@ func (p *PoolWithFunc) periodicallyPurge() {
}
n++
if n > 0 {
if n >= cap(idleWorkers) {
if n >= len(idleWorkers) {
p.workers = idleWorkers[:0]
} else {
p.workers = idleWorkers[n:]