fix: Fixed an issue where the calculation of waiting time was incorrect when the number of users was 0 or too low

This commit is contained in:
LWR
2023-05-21 17:18:19 +08:00
parent e2dbef8739
commit 59ceed81e5
2 changed files with 14 additions and 13 deletions

View File

@@ -117,13 +117,14 @@ class StarBot:
await asyncio.sleep(0.2)
except LiveException as ex:
logger.error(ex.msg)
try:
wait_time = config.get("WAIT_FOR_ALL_CONNECTION_TIMEOUT")
if wait_time == 0:
wait_time = len(self.__datasource.get_up_list()) // 5 * 2
await asyncio.wait_for(self.__datasource.wait_for_connects(), wait_time)
except asyncio.exceptions.TimeoutError:
logger.warning("等待连接所有直播间超时, 请检查是否存在未连接成功的直播间")
if len(self.__datasource.get_up_list()) > 0:
try:
wait_time = config.get("WAIT_FOR_ALL_CONNECTION_TIMEOUT")
if wait_time == 0:
wait_time = (len(self.__datasource.get_up_list()) + 5) // 5 * 2
await asyncio.wait_for(self.__datasource.wait_for_connects(), wait_time)
except asyncio.exceptions.TimeoutError:
logger.warning("等待连接所有直播间超时, 请检查是否存在未连接成功的直播间")
# 启动动态推送模块
asyncio.get_event_loop().create_task(dynamic_spider(self.__datasource))

View File

@@ -108,11 +108,11 @@ SIMPLE_CONFIG = {
# 每个群动态 @ 我命令人数上限,单次 @ 人数过多容易被风控,不推荐修改
"COMMAND_DYNAMIC_AT_ME_LIMIT": 20,
# 是否启用风控消息补发
# 是否启用风控消息补发,暂未实现
"BAN_RESEND": False,
# 风控发送失败消息滞留时间上限消息因风控滞留超出此时长不会进行补发0 为无限制,单位:秒
# 风控发送失败消息滞留时间上限消息因风控滞留超出此时长不会进行补发0 为无限制,单位:秒,暂未实现
"RESEND_TIME_LIMIT": 0,
# 是否补发开播推送、下播推送、直播报告、动态推送中的 @全体成员 和 @群成员 消息,可能造成不必要的打扰,不推荐开启
# 是否补发开播推送、下播推送、直播报告、动态推送中的 @全体成员 和 @群成员 消息,可能造成不必要的打扰,不推荐开启,暂未实现
"RESEND_AT_MESSAGE": False
}
@@ -224,11 +224,11 @@ FULL_CONFIG = {
# 每个群动态 @ 我命令人数上限,单次 @ 人数过多容易被风控,不推荐修改
"COMMAND_DYNAMIC_AT_ME_LIMIT": 20,
# 是否启用风控消息补发
# 是否启用风控消息补发,暂未实现
"BAN_RESEND": True,
# 风控发送失败消息滞留时间上限消息因风控滞留超出此时长不会进行补发0 为无限制,单位:秒
# 风控发送失败消息滞留时间上限消息因风控滞留超出此时长不会进行补发0 为无限制,单位:秒,暂未实现
"RESEND_TIME_LIMIT": 0,
# 是否补发开播推送、下播推送、直播报告、动态推送中的 @全体成员 和 @群成员 消息,可能造成不必要的打扰,不推荐开启
# 是否补发开播推送、下播推送、直播报告、动态推送中的 @全体成员 和 @群成员 消息,可能造成不必要的打扰,不推荐开启,暂未实现
"RESEND_AT_MESSAGE": False
}