From 50918eb4a9c03d245529b24c7806063d3dc84068 Mon Sep 17 00:00:00 2001 From: andy pan Date: Wed, 8 Aug 2018 18:13:50 +0800 Subject: [PATCH] update --- pool.go | 2 +- pool_func.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pool.go b/pool.go index c3f5568..656bf19 100644 --- a/pool.go +++ b/pool.go @@ -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:] diff --git a/pool_func.go b/pool_func.go index 3e6dc5e..0b2eed5 100644 --- a/pool_func.go +++ b/pool_func.go @@ -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:]