修复后端重连时报错

This commit is contained in:
John Smith 2023-09-16 23:01:45 +08:00
parent dccb3fc890
commit a11de39166

View File

@ -114,9 +114,11 @@ class LiveClientManager:
client_room_manager.del_room(room_key) client_room_manager.del_room(room_key)
RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10)
class WebLiveClient(blivedm.BLiveClient): class WebLiveClient(blivedm.BLiveClient):
HEARTBEAT_INTERVAL = 10 HEARTBEAT_INTERVAL = 10
RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10)
def __init__(self, room_key: RoomKey): def __init__(self, room_key: RoomKey):
assert room_key.type == RoomKeyType.ROOM_ID assert room_key.type == RoomKeyType.ROOM_ID
@ -126,7 +128,7 @@ class WebLiveClient(blivedm.BLiveClient):
session=utils.request.http_session, session=utils.request.http_session,
heartbeat_interval=self.HEARTBEAT_INTERVAL, heartbeat_interval=self.HEARTBEAT_INTERVAL,
) )
self.set_reconnect_policy(self.RECONNECT_POLICY) self.set_reconnect_policy(RECONNECT_POLICY)
@property @property
def room_key(self): def room_key(self):
@ -144,7 +146,6 @@ class WebLiveClient(blivedm.BLiveClient):
class OpenLiveClient(blivedm.OpenLiveClient): class OpenLiveClient(blivedm.OpenLiveClient):
HEARTBEAT_INTERVAL = 10 HEARTBEAT_INTERVAL = 10
RECONNECT_POLICY = dm_utils.make_linear_retry_policy(1, 2, 10)
def __init__(self, room_key: RoomKey): def __init__(self, room_key: RoomKey):
assert room_key.type == RoomKeyType.AUTH_CODE assert room_key.type == RoomKeyType.AUTH_CODE
@ -157,7 +158,7 @@ class OpenLiveClient(blivedm.OpenLiveClient):
session=utils.request.http_session, session=utils.request.http_session,
heartbeat_interval=self.HEARTBEAT_INTERVAL, heartbeat_interval=self.HEARTBEAT_INTERVAL,
) )
self.set_reconnect_policy(self.RECONNECT_POLICY) self.set_reconnect_policy(RECONNECT_POLICY)
@property @property
def room_key(self): def room_key(self):