From f9af4304aa2fee21d2135f2a8364e15671585cef Mon Sep 17 00:00:00 2001 From: Nedyalko Dyakov Date: Thu, 28 Aug 2025 19:07:09 +0300 Subject: [PATCH] pooling fix --- internal/pool/pool.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/pool/pool.go b/internal/pool/pool.go index c7a83589..10745ed1 100644 --- a/internal/pool/pool.go +++ b/internal/pool/pool.go @@ -536,11 +536,12 @@ func (p *ConnPool) popIdle() (*Conn, error) { // LIFO: put at beginning (will be picked up last since we pop from end) p.idleConns = append([]*Conn{cn}, p.idleConns...) } + cn = nil } // If we exhausted all attempts without finding a usable connection, return nil - if attempts > 1 && attempts >= maxAttempts { - //internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts) + if int32(attempts) >= p.poolSize.Load() { + internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts) return nil, nil }