forked from mirror/ants
Merge branch 'develop'
This commit is contained in:
commit
666635c65d
2
pool.go
2
pool.go
|
@ -77,13 +77,11 @@ func (p *Pool) periodicallyPurge() {
|
|||
idleWorkers[i] = nil
|
||||
}
|
||||
n++
|
||||
if n > 0 {
|
||||
if n >= len(idleWorkers) {
|
||||
p.workers = idleWorkers[:0]
|
||||
} else {
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
}
|
||||
p.lock.Unlock()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,13 +78,11 @@ func (p *PoolWithFunc) periodicallyPurge() {
|
|||
idleWorkers[i] = nil
|
||||
}
|
||||
n++
|
||||
if n > 0 {
|
||||
if n >= len(idleWorkers) {
|
||||
p.workers = idleWorkers[:0]
|
||||
} else {
|
||||
p.workers = idleWorkers[n:]
|
||||
}
|
||||
}
|
||||
p.lock.Unlock()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue