removed unnecessary variable

This commit is contained in:
Nikolay Vorobev 2023-11-17 01:20:17 +03:00
parent 0bc34b8a83
commit 5a5d911a98
1 changed files with 3 additions and 8 deletions

View File

@ -164,17 +164,12 @@ func (p *ConnPool) NewConn(ctx context.Context) (*Conn, error) {
}
func (p *ConnPool) newConn(ctx context.Context, pooled bool) (*Conn, error) {
var poolExhausted bool
p.connsMu.Lock()
if p.cfg.PoolSizeStrict {
poolExhausted = len(p.conns) >= p.poolSize
}
p.connsMu.Unlock()
if poolExhausted {
if p.cfg.PoolSizeStrict && len(p.conns) >= p.poolSize {
p.connsMu.Unlock()
return nil, ErrPoolExhausted
}
p.connsMu.Unlock()
cn, err := p.dialConn(ctx, pooled)
if err != nil {