fix data race

This commit is contained in:
wanglei6 2020-04-30 14:34:48 +08:00
parent c9f2e839d2
commit 4d5f8a5df3
1 changed files with 2 additions and 1 deletions

View File

@ -93,8 +93,9 @@ func NewConnPool(opt *Options) *ConnPool {
idleConns: make([]*Conn, 0, opt.PoolSize),
closedCh: make(chan struct{}),
}
p.connsMu.Lock()
p.checkMinIdleConns()
p.connsMu.Unlock()
if opt.IdleTimeout > 0 && opt.IdleCheckFrequency > 0 {
go p.reaper(opt.IdleCheckFrequency)