From 4553a7a1c646263815e0eef7aaaa490be0679231 Mon Sep 17 00:00:00 2001
From: Andy Pan <panjf2000@gmail.com>
Date: Mon, 16 Jul 2018 02:43:38 +0800
Subject: [PATCH] update codecov test

---
 pool.go      | 9 ++++-----
 pool_func.go | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/pool.go b/pool.go
index 4f8dbae..1420c2e 100644
--- a/pool.go
+++ b/pool.go
@@ -145,14 +145,13 @@ func (p *Pool) Cap() int {
 func (p *Pool) ReSize(size int) {
 	if size == p.Cap() {
 		return
-	} else if size < p.Cap() {
-		diff := p.Cap() - size
-		atomic.StoreInt32(&p.capacity, int32(size))
+	}
+	atomic.StoreInt32(&p.capacity, int32(size))
+	diff := p.Running() - size
+	if diff > 0 {
 		for i := 0; i < diff; i++ {
 			p.getWorker().task <- nil
 		}
-	} else {
-		atomic.StoreInt32(&p.capacity, int32(size))
 	}
 }
 
diff --git a/pool_func.go b/pool_func.go
index 6099868..6ba7817 100644
--- a/pool_func.go
+++ b/pool_func.go
@@ -150,14 +150,13 @@ func (p *PoolWithFunc) Cap() int {
 func (p *PoolWithFunc) ReSize(size int) {
 	if size == p.Cap() {
 		return
-	} else if size < p.Cap() {
-		diff := p.Cap() - size
-		atomic.StoreInt32(&p.capacity, int32(size))
+	}
+	atomic.StoreInt32(&p.capacity, int32(size))
+	diff := p.Running() - size
+	if diff > 0 {
 		for i := 0; i < diff; i++ {
 			p.getWorker().args <- nil
 		}
-	} else {
-		atomic.StoreInt32(&p.capacity, int32(size))
 	}
 }