fix: every chat message fails on a Redis Cluster deployment (#33766)

With REDIS_CLUSTER enabled, every chat message failed with an error. The Redis connection recently added for terminal connections was used before it had read the cluster's layout. That connection now reads the layout first, so chats work again on a Redis Cluster. Plain Redis and Sentinel setups behave as before.

Fixes #33765
This commit is contained in:
Classic298 2026-11-05 10:40:11 +01:00 • committed by GitHub
parent 393dd6689c
commit 5beeb0cc29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -219,6 +219,8 @@ class Hub:
async_mode=True,
decode_responses=False,
)
# RedisCluster can't route a pubsub subscribe until initialize() fills its slot cache.
await self.redis.initialize()
pubsub = self.redis.pubsub()
await pubsub.subscribe(self.channel(self.worker))
self.listener = asyncio.create_task(self.listen(pubsub))