fix: Fixed an issue where 'WAIT_FOR_ALL_CONNECTION_TIMEOUT' config was not taking effect
This commit is contained in:
+7
-4
@@ -192,13 +192,16 @@ class StarBot:
|
|||||||
await redis.set_live_start_time(up.room_id, start_time)
|
await redis.set_live_start_time(up.room_id, start_time)
|
||||||
|
|
||||||
# 连接直播间
|
# 连接直播间
|
||||||
|
async def connect_room_task():
|
||||||
interval = config.get("CONNECTION_INTERVAL")
|
interval = config.get("CONNECTION_INTERVAL")
|
||||||
for up in self.__datasource.get_up_list():
|
for u in self.__datasource.get_up_list():
|
||||||
try:
|
try:
|
||||||
await up.connect()
|
if await u.connect():
|
||||||
await asyncio.sleep(interval)
|
await asyncio.sleep(interval)
|
||||||
except LiveException as ex:
|
except LiveException as e:
|
||||||
logger.error(ex.msg)
|
logger.error(e.msg)
|
||||||
|
|
||||||
|
asyncio.create_task(connect_room_task())
|
||||||
if len(self.__datasource.get_up_list()) > 0:
|
if len(self.__datasource.get_up_list()) > 0:
|
||||||
try:
|
try:
|
||||||
wait_time = config.get("WAIT_FOR_ALL_CONNECTION_TIMEOUT")
|
wait_time = config.get("WAIT_FOR_ALL_CONNECTION_TIMEOUT")
|
||||||
|
|||||||
@@ -117,11 +117,11 @@ class Up(BaseModel):
|
|||||||
# 开播推送开关和下播推送开关均处于关闭状态时跳过连接直播间,以节省性能
|
# 开播推送开关和下播推送开关均处于关闭状态时跳过连接直播间,以节省性能
|
||||||
if config.get("ONLY_CONNECT_NECESSARY_ROOM") and not self.is_need_connect():
|
if config.get("ONLY_CONNECT_NECESSARY_ROOM") and not self.is_need_connect():
|
||||||
logger.warning(f"{self.uname} 的开播, 下播和直播报告开关均处于关闭状态, 跳过连接直播间")
|
logger.warning(f"{self.uname} 的开播, 下播和直播报告开关均处于关闭状态, 跳过连接直播间")
|
||||||
return
|
return False
|
||||||
|
|
||||||
if self.__connecting:
|
if self.__connecting:
|
||||||
logger.warning(f"{self.uname} ( UID: {self.uid} ) 的直播间正在连接中, 跳过重复连接")
|
logger.warning(f"{self.uname} ( UID: {self.uid} ) 的直播间正在连接中, 跳过重复连接")
|
||||||
return
|
return False
|
||||||
self.__connecting = True
|
self.__connecting = True
|
||||||
|
|
||||||
self.__live_room = LiveRoom(self.room_id, get_credential())
|
self.__live_room = LiveRoom(self.room_id, get_credential())
|
||||||
@@ -385,6 +385,8 @@ class Up(BaseModel):
|
|||||||
|
|
||||||
await redis.incr_room_guard_time(self.room_id, int(time.time()), month)
|
await redis.incr_room_guard_time(self.room_id, int(time.time()), month)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
async def disconnect(self):
|
async def disconnect(self):
|
||||||
"""
|
"""
|
||||||
断开连接直播间
|
断开连接直播间
|
||||||
|
|||||||
Reference in New Issue
Block a user