mirror of
https://github.com/redis/go-redis.git
synced 2025-09-05 20:24:00 +03:00
pooling fix
This commit is contained in:
@@ -536,11 +536,12 @@ func (p *ConnPool) popIdle() (*Conn, error) {
|
|||||||
// LIFO: put at beginning (will be picked up last since we pop from end)
|
// LIFO: put at beginning (will be picked up last since we pop from end)
|
||||||
p.idleConns = append([]*Conn{cn}, p.idleConns...)
|
p.idleConns = append([]*Conn{cn}, p.idleConns...)
|
||||||
}
|
}
|
||||||
|
cn = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we exhausted all attempts without finding a usable connection, return nil
|
// If we exhausted all attempts without finding a usable connection, return nil
|
||||||
if attempts > 1 && attempts >= maxAttempts {
|
if int32(attempts) >= p.poolSize.Load() {
|
||||||
//internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts)
|
internal.Logger.Printf(context.Background(), "redis: connection pool: failed to get a usable connection after %d attempts", attempts)
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user