From 3b641752cf6753356066ec28cea93fdda220f945 Mon Sep 17 00:00:00 2001 From: Douglas Dawson Date: Fri, 19 Feb 2021 15:58:28 -0500 Subject: [PATCH] Remove data race. Fixes jordan-wright#141 --- pool.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pool.go b/pool.go index 67f224a..0b4c04e 100644 --- a/pool.go +++ b/pool.go @@ -84,9 +84,7 @@ func (p *Pool) get(timeout time.Duration) *client { default: } - if p.created < p.max { - p.makeOne() - } + p.makeOne() var deadline <-chan time.Time if timeout >= 0 { @@ -142,10 +140,6 @@ func (p *Pool) replace(c *client) { } func (p *Pool) inc() bool { - if p.created >= p.max { - return false - } - p.mut.Lock() defer p.mut.Unlock()