📝 Feature: allow BlockingConnectionPool in RedisBroker (#3371)
RedisBroker(max_connections=N) always uses a plain ConnectionPool, which raises MaxConnectionsError when more than N commands run at once instead of waiting for a free connection.import asyncio
from faststream.redis import RedisBroker
broker = RedisBroker("redis://localhost:6379", max_connections=2)
async def main() -> None:
await broker.connect()
await asyncio.gather(*(broker.publish(i, stream="test") for i in range(10)))
asyncio.run(main())
# redis.exceptions.MaxConnectionsError: Too many connections
redis-py's
BlockingConnectionPool waits for a free connection and handles the same load, but FastStream has no way to use it (connection_class is the connection class, not the pool class).Proposal: a parameter for the pool class, e.g.
RedisBroker(url, max_connections=2, connection_pool_class=BlockingConnectionPool)
FastStream 0.7.8, redis 8.1.0, Redis 8.4.
#enhancement #good_first_issue #faststream #ag2ai
sent via relator