🩹 API重试添加额外错误捕获

This commit is contained in:
HibiKier 2025-02-14 18:20:52 +08:00
parent a77d350dfb
commit f4a6acfbd4
2 changed files with 9 additions and 2 deletions

View File

@ -29,6 +29,7 @@ _flmt = FreqLimiter(300)
async def _(
matcher: Matcher, bot: Bot, event: Event, state: T_State, session: EventSession
):
extra = {}
if plugin := matcher.plugin:
if metadata := plugin.metadata:
extra = metadata.extra
@ -66,7 +67,12 @@ async def _(
time_str = f"{hours} 小时 {minute}分钟"
else:
time_str = f"{minute} 分钟"
if time != -1 and ban_result and _flmt.check(user_id):
if (
not extra.get("ignore_prompt")
and time != -1
and ban_result
and _flmt.check(user_id)
):
_flmt.start_cd(user_id)
await MessageUtils.build_message(
[

View File

@ -1,3 +1,4 @@
from anyio import EndOfStream
from httpx import ConnectError, HTTPStatusError, TimeoutException
from tenacity import retry, retry_if_exception_type, stop_after_attempt, wait_fixed
@ -11,6 +12,6 @@ class Retry:
stop=stop_after_attempt(3),
wait=wait_fixed(1),
retry=retry_if_exception_type(
(TimeoutException, ConnectError, HTTPStatusError)
(TimeoutException, ConnectError, HTTPStatusError, EndOfStream)
),
)