Skip to content

Commit 5a5d911

Browse files
committed
removed unnecessary variable
1 parent 0bc34b8 commit 5a5d911

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

internal/pool/pool.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,12 @@ func (p *ConnPool) NewConn(ctx context.Context) (*Conn, error) {
164164
}
165165

166166
func (p *ConnPool) newConn(ctx context.Context, pooled bool) (*Conn, error) {
167-
var poolExhausted bool
168-
169167
p.connsMu.Lock()
170-
if p.cfg.PoolSizeStrict {
171-
poolExhausted = len(p.conns) >= p.poolSize
172-
}
173-
p.connsMu.Unlock()
174-
175-
if poolExhausted {
168+
if p.cfg.PoolSizeStrict && len(p.conns) >= p.poolSize {
169+
p.connsMu.Unlock()
176170
return nil, ErrPoolExhausted
177171
}
172+
p.connsMu.Unlock()
178173

179174
cn, err := p.dialConn(ctx, pooled)
180175
if err != nil {

0 commit comments

Comments
 (0)