From d9eac77ae5269763129d251acbf5f53a58543ea8 Mon Sep 17 00:00:00 2001 From: SimePel Date: Mon, 1 Oct 2018 19:45:21 +0700 Subject: [PATCH 1/2] remove meaningless if --- pool.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pool.go b/pool.go index 04730de..36fe5cb 100644 --- a/pool.go +++ b/pool.go @@ -146,10 +146,8 @@ func (p *Pool) ReSize(size int) { } atomic.StoreInt32(&p.capacity, int32(size)) diff := p.Running() - size - if diff > 0 { - for i := 0; i < diff; i++ { - p.getWorker().task <- nil - } + for i := 0; i < diff; i++ { + p.getWorker().task <- nil } } From 5ed168767a771e3802252020b9821610380ed1a4 Mon Sep 17 00:00:00 2001 From: SimePel Date: Tue, 2 Oct 2018 08:18:34 +0700 Subject: [PATCH 2/2] remove another one useless if statement --- pool_func.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pool_func.go b/pool_func.go index 3423ab7..fbcbe9d 100644 --- a/pool_func.go +++ b/pool_func.go @@ -148,10 +148,8 @@ func (p *PoolWithFunc) ReSize(size int) { } atomic.StoreInt32(&p.capacity, int32(size)) diff := p.Running() - size - if diff > 0 { - for i := 0; i < diff; i++ { - p.getWorker().args <- nil - } + for i := 0; i < diff; i++ { + p.getWorker().args <- nil } }