From 5a5d911a980a7778d4d9117b9d433ac5cab37cc0 Mon Sep 17 00:00:00 2001 From: Nikolay Vorobev Date: Fri, 17 Nov 2023 01:20:17 +0300 Subject: [PATCH] removed unnecessary variable --- internal/pool/pool.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/internal/pool/pool.go b/internal/pool/pool.go index 2ff31e28..37a7ff75 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -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 {