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 authored and GitHub committed 2026-11-05 18:40:11 +09:00
1 parent 393dd6689c
commit 5beeb0cc29
1 file changed
+2
+2
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))