Merge pull request #1315 from lwightmoon/master

fix NewConnPool checkMinIdleConns data race
This commit is contained in:
Vladimir Mihailenco 2020-05-19 08:52:02 +03:00 committed by GitHub
commit 64bb0b7f3a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -94,7 +94,9 @@ func NewConnPool(opt *Options) *ConnPool {
closedCh: make(chan struct{}),
}
p.connsMu.Lock()
p.checkMinIdleConns()
p.connsMu.Unlock()
if opt.IdleTimeout > 0 && opt.IdleCheckFrequency > 0 {
go p.reaper(opt.IdleCheckFrequency)