fix(automation): 租约巡检降为4小时并收紧首次登录样本
- lease_bound 30 分钟会超出 ck_health 吞吐,改为 240 分钟 - 首次登录样本排除缺账号/密码和已判极验/凭证失败的账号 - 补充保护组和首登样本准入测试
This commit is contained in:
@@ -61,7 +61,7 @@ GROUP_DEFINITIONS: dict[str, dict[str, Any]] = {
|
||||
"description": "当前所有生效的直播履约/协作租约账号,优先 CK 巡检和到期前刷新",
|
||||
"enabled": True,
|
||||
"target_count": 0,
|
||||
"probe_interval_minutes": 30,
|
||||
"probe_interval_minutes": 240,
|
||||
"auto_relogin": True,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ from sqlalchemy import func, or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ....models import Account, AutomationJob, LoginTask
|
||||
from ...account_lifecycle import MANUAL_STATES, STATUS_MANUAL
|
||||
from ...account_lifecycle import MANUAL_KINDS, MANUAL_STATES, STATUS_MANUAL
|
||||
from ...login_automation import run_login_batch_with_fallback, system_user_id
|
||||
|
||||
JOB_KEY = "account_onboarding"
|
||||
@@ -38,6 +38,13 @@ def build_select_query(
|
||||
.filter(
|
||||
Account.auto_managed.is_(True),
|
||||
Account.status.notin_((*MANUAL_STATES, STATUS_MANUAL)),
|
||||
# 缺账号/密码的账号首登必失败,不能占样本名额。
|
||||
Account.username != "",
|
||||
Account.password != "",
|
||||
# 已经判定为极验/凭证问题的账号不再自动首登。
|
||||
func.coalesce(Account.relogin_failure_kind, "").notin_(
|
||||
tuple(sorted(MANUAL_KINDS))
|
||||
),
|
||||
or_(Account.cookie.is_(None), Account.cookie == ""),
|
||||
~_in_flight_login_exists(),
|
||||
)
|
||||
@@ -53,6 +60,11 @@ def count_pending_onboarding(db: Session) -> int:
|
||||
.filter(
|
||||
Account.auto_managed.is_(True),
|
||||
Account.status.notin_((*MANUAL_STATES, STATUS_MANUAL)),
|
||||
Account.username != "",
|
||||
Account.password != "",
|
||||
func.coalesce(Account.relogin_failure_kind, "").notin_(
|
||||
tuple(sorted(MANUAL_KINDS))
|
||||
),
|
||||
or_(Account.cookie.is_(None), Account.cookie == ""),
|
||||
~_in_flight_login_exists(),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user