Merge main into dev: 登录导出/失败入流水 + AGENTS.md 修正
把 main 上的两笔带过来,dev 继续在其上开发: -d11fa10登录任务按状态导出 CSV + 登录失败写进账号生命周期 -05b2bf8AGENTS.md 分支约定修正 两条线在此之前无文件重叠(dev 38 个 / main 9 个,交集为空),所以是干净合并。 注意:main 的登录功能不含迁移,dev 的 0052 仍是唯一新增迁移。
This commit is contained in:
@@ -32,6 +32,7 @@ from ...account_lifecycle import (
|
||||
)
|
||||
from ...account_value import value_tier_expr
|
||||
from ...douyu_service import cookie_holding_filter, cookie_operable_filter
|
||||
from ...login_failure import classify_failure
|
||||
from ...login_service import LoginBatchRunner, get_relogin_limits
|
||||
|
||||
JOB_KEY = "ck_relogin"
|
||||
@@ -54,29 +55,6 @@ AUTO_MAX_TOTAL_TIME = 240
|
||||
QUOTA_JITTER_MINUTES = 30
|
||||
|
||||
|
||||
def classify_failure(message: str | None) -> str:
|
||||
"""把重登失败消息映射成分型(见规划 §7.4.3)。
|
||||
|
||||
顺序很重要:「邮箱验证码发送次数已达上限」既含「验证码」也含「上限」,
|
||||
必须先在 ``email_quota`` 命中,否则会被归到可重试的 ``email_code`` 上,
|
||||
导致次日才该重试的账号被按小时反复撞配额。
|
||||
"""
|
||||
text = message or ""
|
||||
if "上限" in text or "配额" in text:
|
||||
return "email_quota"
|
||||
if "极验" in text or "验证" in text and "滑块" in text:
|
||||
return "captcha"
|
||||
if "验证码" in text:
|
||||
return "email_code"
|
||||
if "中断" in text or "已停止" in text or "任务已停止" in text:
|
||||
return "interrupted"
|
||||
if "密码" in text or "账号不存在" in text or "缺少密码或邮箱" in text:
|
||||
return "credential"
|
||||
# 请求失败/超时/连接异常,以及未知文案:都按可重试处理。
|
||||
# 宁可多给一次机会(有每日上限兜底),也不要把可能只是抖动的账号推给人工。
|
||||
return "network"
|
||||
|
||||
|
||||
def _cutoff(now: datetime) -> datetime:
|
||||
return now
|
||||
|
||||
|
||||
Reference in New Issue
Block a user