Skip to content

Commit ccb75bd

Browse files
committed
Update utils.py
1 parent 7967c67 commit ccb75bd

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/api/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ async def handle_error_with_retry(
7979
仅在以下情况下进行自动重试:
8080
1. 429错误(速率限制)
8181
2. 503错误(服务不可用)
82-
3. 导致凭证封禁的错误(AUTO_BAN_ERROR_CODES配置)
82+
3. 500错误(服务临时不可用)
83+
4. 导致凭证封禁的错误(AUTO_BAN_ERROR_CODES配置)
8384
8485
Args:
8586
credential_manager: 凭证管理器实例
@@ -111,8 +112,8 @@ async def handle_error_with_retry(
111112
return True
112113
return False
113114

114-
# 如果不触发自动封禁,仅对429和503错误进行重试
115-
if (status_code == 429 or status_code == 503) and retry_enabled and attempt < max_retries:
115+
# 如果不触发自动封禁,仅对429、503和500错误进行重试
116+
if status_code in (429, 500, 503) and retry_enabled and attempt < max_retries:
116117
log.info(
117118
f"[{mode.upper()} RETRY] {status_code} error encountered, retrying "
118119
f"(attempt {attempt + 1}/{max_retries})"

0 commit comments

Comments
 (0)