优化(账号自动化): 履约保护登录配额与重登优先级

This commit is contained in:
yml
2026-11-25 22:13:21 +08:00
parent 0943b7a362
commit 9bdd2f4e1a
25 changed files with 1510 additions and 193 deletions
+11 -5
View File
@@ -21,9 +21,8 @@ FALLBACK_LOGIN_API = "iframe"
#: 1.5 封涨到 3.3 封,邮件延迟随即从 10 秒级恶化到 8~13 分钟,取码成功率反而
#: 从 100% 掉到 20% 左右。取码失败现在靠「补等迟到邮件 + 批次级退避重试」处理。
EMAIL_FALLBACK_KINDS: frozenset[str] = frozenset()
# 单账号总时长上限:要覆盖斗鱼验证码邮件的最坏投递延迟(实测 8~13 分钟),
# 否则等待会被预算掐断,账号白白失败。
DEFAULT_MAX_TOTAL_TIME = 1800
# 单账号总时长上限:覆盖极验 + 一轮邮箱验证码最多 3 分钟(180s)等待。
DEFAULT_MAX_TOTAL_TIME = 300
DEFAULT_MAX_RETRIES = 5
@@ -233,7 +232,12 @@ def run_login_batch_with_fallback(
attempted = dict(primary)
attempted.update(fallback)
outcome.attempted_ids = sorted(attempted)
actually_attempted = [
account_id
for account_id, (status, _) in attempted.items()
if status != "skipped"
]
outcome.attempted_ids = sorted(actually_attempted)
outcome.success_ids = sorted(success_ids)
outcome.failed_ids = [
account_id
@@ -241,7 +245,9 @@ def run_login_batch_with_fallback(
if account_id not in success_ids
]
outcome.skipped_ids = [
account_id for account_id in ordered_ids if account_id not in attempted
account_id
for account_id in ordered_ids
if account_id not in attempted or attempted[account_id][0] == "skipped"
]
for account_id in outcome.failed_ids:
status, kind = attempted.get(account_id, ("", ""))