diff --git a/pool.go b/pool.go index 7224e3d..ee14834 100644 --- a/pool.go +++ b/pool.go @@ -117,6 +117,8 @@ func (p *Pool) ReSize(size int) { for i := 0; i < diff; i++ { p.getWorker().stop() } + } else if size == p.Cap() { + return } atomic.StoreInt32(&p.capacity, int32(size)) } diff --git a/pool_func.go b/pool_func.go index f8354d0..aac9889 100644 --- a/pool_func.go +++ b/pool_func.go @@ -122,6 +122,8 @@ func (p *PoolWithFunc) ReSize(size int) { for i := 0; i < diff; i++ { p.getWorker().stop() } + } else if size == p.Cap(){ + return } atomic.StoreInt32(&p.capacity, int32(size)) }