mirror of
https://github.com/redis/go-redis.git
synced 2025-12-03 18:31:14 +03:00
address linter comment
This commit is contained in:
@@ -469,19 +469,11 @@ func (p *ConnPool) getConn(ctx context.Context) (*Conn, error) {
|
|||||||
|
|
||||||
// Use cached time for health checks (max 50ms staleness is acceptable)
|
// Use cached time for health checks (max 50ms staleness is acceptable)
|
||||||
nowNs := getCachedTimeNs()
|
nowNs := getCachedTimeNs()
|
||||||
attempts := 0
|
|
||||||
|
|
||||||
// Lock-free atomic read - no mutex overhead!
|
// Lock-free atomic read - no mutex overhead!
|
||||||
hookManager := p.hookManager.Load()
|
hookManager := p.hookManager.Load()
|
||||||
|
|
||||||
for {
|
for attempts := 0; attempts < getAttempts; attempts++ {
|
||||||
if attempts >= getAttempts {
|
|
||||||
// Disabling logging here as it's too noisy.
|
|
||||||
// TODO: Enable when we have a better logging solution for log levels
|
|
||||||
//internal.Logger.Printf(ctx, "redis: connection pool: was not able to get a healthy connection after %d attempts", attempts)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
attempts++
|
|
||||||
|
|
||||||
p.connsMu.Lock()
|
p.connsMu.Lock()
|
||||||
cn, err = p.popIdle()
|
cn, err = p.popIdle()
|
||||||
|
|||||||
Reference in New Issue
Block a user