Skip to content

Commit 4d5f8a5

Browse files
author
wanglei6
committed
fix data race
1 parent c9f2e83 commit 4d5f8a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

internal/pool/pool.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ func NewConnPool(opt *Options) *ConnPool {
9393
idleConns: make([]*Conn, 0, opt.PoolSize),
9494
closedCh: make(chan struct{}),
9595
}
96-
96+
p.connsMu.Lock()
9797
p.checkMinIdleConns()
98+
p.connsMu.Unlock()
9899

99100
if opt.IdleTimeout > 0 && opt.IdleCheckFrequency > 0 {
100101
go p.reaper(opt.IdleCheckFrequency)

0 commit comments

Comments
 (0)