Description
Problem:
BlockingConnectionPool does not recover if redis disconnects.
Version: 5.0.1
How to reproduce:
Create a BlockingConnectionPool pool use it for periodic tasks, stop redis/start it back. no query to redis succeeds anymore. Sometimes it recovers but most of the times it does not.
Possible solution
Connection at this line
https://github.com/redis/redis-py/blob/d3a3ada03e080f39144807c9fbe44876c40e0548/redis/connection.py#L1102C23-L1102C23.
should not be returned in the pool, because it is broken, it should be disconnected from the pool:
await self.disconnect(connection, inuse_connections=True)
actually the self.release(connection) should be called in a sync manner, because if calls async it will endup in some kind of deadlock with another connection release