Skip to content

Commit f9af430

Browse files
committed
pooling fix
1 parent 18150e4 commit f9af430

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

internal/pool/pool.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,11 +536,12 @@ func (p *ConnPool) popIdle() (*Conn, error) {
536536
// LIFO: put at beginning (will be picked up last since we pop from end)
537537
p.idleConns = append([]*Conn{cn}, p.idleConns...)
538538
}
539+
cn = nil
539540
}
540541

541542
// If we exhausted all attempts without finding a usable connection, return nil
542-
if attempts > 1 && attempts >= maxAttempts {
543-
//internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts)
543+
if int32(attempts) >= p.poolSize.Load() {
544+
internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts)
544545
return nil, nil
545546
}
546547

0 commit comments

Comments
 (0)