From a11de39166529b9bfe3c9011be745b0281fc946d Mon Sep 17 00:00:00 2001 From: John Smith Date: Sat, 16 Sep 2023 23:01:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=90=8E=E7=AB=AF=E9=87=8D?= =?UTF-8?q?=E8=BF=9E=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/chat.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/chat.py b/services/chat.py index 9cdf4be..927d7cb 100644 --- a/services/chat.py +++ b/services/chat.py @@ -114,9 +114,11 @@ class LiveClientManager: client_room_manager.del_room(room_key) +RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10) + + class WebLiveClient(blivedm.BLiveClient): HEARTBEAT_INTERVAL = 10 - RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10) def __init__(self, room_key: RoomKey): assert room_key.type == RoomKeyType.ROOM_ID @@ -126,7 +128,7 @@ class WebLiveClient(blivedm.BLiveClient): session=utils.request.http_session, heartbeat_interval=self.HEARTBEAT_INTERVAL, ) - self.set_reconnect_policy(self.RECONNECT_POLICY) + self.set_reconnect_policy(RECONNECT_POLICY) @property def room_key(self): @@ -144,7 +146,6 @@ class WebLiveClient(blivedm.BLiveClient): class OpenLiveClient(blivedm.OpenLiveClient): HEARTBEAT_INTERVAL = 10 - RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10) def __init__(self, room_key: RoomKey): assert room_key.type == RoomKeyType.AUTH_CODE @@ -157,7 +158,7 @@ class OpenLiveClient(blivedm.OpenLiveClient): session=utils.request.http_session, heartbeat_interval=self.HEARTBEAT_INTERVAL, ) - self.set_reconnect_policy(self.RECONNECT_POLICY) + self.set_reconnect_policy(RECONNECT_POLICY) @property def room_key(self):