diff --git a/pool.go b/pool.go index 656bf19..2479f3b 100644 --- a/pool.go +++ b/pool.go @@ -77,12 +77,10 @@ func (p *Pool) periodicallyPurge() { idleWorkers[i] = nil } n++ - if n > 0 { - if n >= len(idleWorkers) { - p.workers = idleWorkers[:0] - } else { - p.workers = idleWorkers[n:] - } + if n >= len(idleWorkers) { + p.workers = idleWorkers[:0] + } else { + p.workers = idleWorkers[n:] } p.lock.Unlock() } diff --git a/pool_func.go b/pool_func.go index 0b2eed5..5a3617c 100644 --- a/pool_func.go +++ b/pool_func.go @@ -78,12 +78,10 @@ func (p *PoolWithFunc) periodicallyPurge() { idleWorkers[i] = nil } n++ - if n > 0 { - if n >= len(idleWorkers) { - p.workers = idleWorkers[:0] - } else { - p.workers = idleWorkers[n:] - } + if n >= len(idleWorkers) { + p.workers = idleWorkers[:0] + } else { + p.workers = idleWorkers[n:] } p.lock.Unlock() }