fix: Fixed an issue where 'WAIT_FOR_ALL_CONNECTION_TIMEOUT' config was not taking effect
This commit is contained in:
parent
fca06770a6
commit
5b9dfae594
@ -192,13 +192,16 @@ class StarBot:
|
||||
await redis.set_live_start_time(up.room_id, start_time)
|
||||
|
||||
# 连接直播间
|
||||
interval = config.get("CONNECTION_INTERVAL")
|
||||
for up in self.__datasource.get_up_list():
|
||||
try:
|
||||
await up.connect()
|
||||
await asyncio.sleep(interval)
|
||||
except LiveException as ex:
|
||||
logger.error(ex.msg)
|
||||
async def connect_room_task():
|
||||
interval = config.get("CONNECTION_INTERVAL")
|
||||
for u in self.__datasource.get_up_list():
|
||||
try:
|
||||
if await u.connect():
|
||||
await asyncio.sleep(interval)
|
||||
except LiveException as e:
|
||||
logger.error(e.msg)
|
||||
|
||||
asyncio.create_task(connect_room_task())
|
||||
if len(self.__datasource.get_up_list()) > 0:
|
||||
try:
|
||||
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():
|
||||
logger.warning(f"{self.uname} 的开播, 下播和直播报告开关均处于关闭状态, 跳过连接直播间")
|
||||
return
|
||||
return False
|
||||
|
||||
if self.__connecting:
|
||||
logger.warning(f"{self.uname} ( UID: {self.uid} ) 的直播间正在连接中, 跳过重复连接")
|
||||
return
|
||||
return False
|
||||
self.__connecting = True
|
||||
|
||||
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)
|
||||
|
||||
return True
|
||||
|
||||
async def disconnect(self):
|
||||
"""
|
||||
断开连接直播间
|
||||
|
Loading…
x
Reference in New Issue
Block a user