From d898bcff90b850578bf1438d835170af7eed289a Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Thu, 5 Feb 2026 15:22:09 +0800 Subject: [PATCH] feat(api): adjust timeout for get_message to 1s --- api/libs/broadcast_channel/redis/channel.py | 2 +- api/libs/broadcast_channel/redis/sharded_channel.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/libs/broadcast_channel/redis/channel.py b/api/libs/broadcast_channel/redis/channel.py index 51c86e0bd0..35a227769c 100644 --- a/api/libs/broadcast_channel/redis/channel.py +++ b/api/libs/broadcast_channel/redis/channel.py @@ -64,7 +64,7 @@ class _RedisSubscription(RedisSubscriptionBase): def _get_message(self) -> dict | None: assert self._pubsub is not None - return self._pubsub.get_message(ignore_subscribe_messages=True, timeout=0.1) + return self._pubsub.get_message(ignore_subscribe_messages=True, timeout=1) def _get_message_type(self) -> str: return "message" diff --git a/api/libs/broadcast_channel/redis/sharded_channel.py b/api/libs/broadcast_channel/redis/sharded_channel.py index 9a5fc9cdcf..6dfb494ad7 100644 --- a/api/libs/broadcast_channel/redis/sharded_channel.py +++ b/api/libs/broadcast_channel/redis/sharded_channel.py @@ -73,11 +73,11 @@ class _RedisShardedSubscription(RedisSubscriptionBase): node = self._client.get_node_from_key(self._topic) return self._pubsub.get_sharded_message( ignore_subscribe_messages=False, - timeout=0.1, + timeout=1, target_node=node, ) else: - return self._pubsub.get_sharded_message(ignore_subscribe_messages=False, timeout=0.1) # type: ignore[attr-defined] + return self._pubsub.get_sharded_message(ignore_subscribe_messages=False, timeout=1) # type: ignore[attr-defined] def _get_message_type(self) -> str: return "smessage"