优化(账号自动化): 受保护账号极验重登允许按上限重试
This commit is contained in:
@@ -44,7 +44,10 @@ from ...account_protection_service import (
|
||||
ProtectionSnapshot,
|
||||
load_protection_snapshot,
|
||||
)
|
||||
from ...account_query_filters import automation_account_filter
|
||||
from ...account_query_filters import (
|
||||
automation_account_filter,
|
||||
relogin_failure_kind_filter,
|
||||
)
|
||||
from ...account_value import is_high_value_expr, value_tier_expr
|
||||
from ...account_work_queue import (
|
||||
WORK_AGING_SECONDS,
|
||||
@@ -179,8 +182,9 @@ def _eligible_account_query(
|
||||
.filter(Account.relogin_attempts < max_attempts)
|
||||
# 已判定需要人工的类型不再自动重试。空值用 coalesce 兜住历史值。
|
||||
.filter(
|
||||
func.coalesce(Account.relogin_failure_kind, "").notin_(
|
||||
tuple(sorted(MANUAL_KINDS))
|
||||
relogin_failure_kind_filter(
|
||||
protected_ids=protection.relogin_ids,
|
||||
max_attempts=max_attempts,
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -961,6 +965,7 @@ def settle_results(
|
||||
"email_quota": 0,
|
||||
"skipped": 0,
|
||||
}
|
||||
protected_ids = load_protection_snapshot(db).relogin_ids
|
||||
for account_id in account_ids:
|
||||
entry = fresh.get(account_id)
|
||||
if entry is None:
|
||||
@@ -1007,7 +1012,14 @@ def settle_results(
|
||||
account.relogin_failure_kind = kind
|
||||
account.relogin_last_error = (task.attempt_message or "")[:500]
|
||||
account.relogin_attempts = int(account.relogin_attempts or 0) + 1
|
||||
if kind in MANUAL_KINDS or account.relogin_attempts >= max_attempts:
|
||||
protected_captcha_retry = (
|
||||
kind == "captcha"
|
||||
and int(account.id) in protected_ids
|
||||
and account.relogin_attempts < max_attempts
|
||||
)
|
||||
if (
|
||||
kind in MANUAL_KINDS and not protected_captcha_retry
|
||||
) or account.relogin_attempts >= max_attempts:
|
||||
# 转人工:极验/凭证问题重试无意义,次数用尽也不该无限撞。
|
||||
counters["manual"] += 1
|
||||
account.relogin_next_at = None
|
||||
|
||||
Reference in New Issue
Block a user