优化(登录预算与任务): 建议上限封顶2000、错误中文化及补全跳过触发来源
This commit is contained in:
@@ -23,12 +23,13 @@ MIN_RECENT_SAMPLE = 20
|
||||
DEFAULT_SUCCESS_RATE = 70.0
|
||||
MIN_EFFECTIVE_SUCCESS_RATE = 35.0
|
||||
MIN_DAILY_ATTEMPTS = 50
|
||||
MAX_DAILY_ATTEMPTS = 5000
|
||||
MAX_DAILY_ATTEMPTS = 2000
|
||||
MAX_MANUAL_RESERVE = 200
|
||||
ASSUMED_ACTIVE_HOURS = 12
|
||||
|
||||
|
||||
def _fit_priority_budgets(limits: list[int], available: int) -> list[int]:
|
||||
"""把 P0-P3 预算压进全局可用名额,按优先级从低到高削减。"""
|
||||
"""把 P0-P4 预算压进全局可用名额,按优先级从低到高削减。"""
|
||||
fitted = list(limits)
|
||||
excess = max(0, sum(fitted) - max(0, int(available)))
|
||||
for index in range(len(fitted) - 1, -1, -1):
|
||||
@@ -219,7 +220,11 @@ def recommend_login_budget(
|
||||
expected_daily_invalid + recovery_pressure + onboarding_pressure
|
||||
)
|
||||
core_attempts = math.ceil(required_success / effective_rate)
|
||||
manual_reserve = max(30, math.ceil(core_attempts * 0.1))
|
||||
# 人工预留按每日总预算(而非未封顶需求)比例计算并设上限,避免大库存时挤占 P0-P3 自动化预算。
|
||||
raw_manual_reserve = min(
|
||||
MAX_MANUAL_RESERVE,
|
||||
max(30, math.ceil(min(MAX_DAILY_ATTEMPTS, core_attempts) * 0.1)),
|
||||
)
|
||||
onboarding_attempts = math.ceil(onboarding_pressure / effective_rate)
|
||||
nonprotected_relogin_pressure_high = (
|
||||
nonprotected_valid_high / CK_AVERAGE_LIFETIME_DAYS
|
||||
@@ -257,35 +262,36 @@ def recommend_login_budget(
|
||||
),
|
||||
)
|
||||
|
||||
raw_relogin_limits = [
|
||||
raw_priority_limits = [
|
||||
relogin_protected_limit,
|
||||
lease_refresh_limit,
|
||||
relogin_high_limit,
|
||||
relogin_ordinary_limit,
|
||||
onboarding_attempts,
|
||||
]
|
||||
planned_attempts = (
|
||||
sum(raw_relogin_limits) + onboarding_attempts + manual_reserve
|
||||
)
|
||||
planned_attempts = sum(raw_priority_limits) + raw_manual_reserve
|
||||
daily_attempts = min(
|
||||
MAX_DAILY_ATTEMPTS,
|
||||
max(
|
||||
MIN_DAILY_ATTEMPTS,
|
||||
core_attempts + manual_reserve,
|
||||
core_attempts + raw_manual_reserve,
|
||||
planned_attempts,
|
||||
),
|
||||
)
|
||||
available_relogin_attempts = max(
|
||||
0,
|
||||
daily_attempts - onboarding_attempts - manual_reserve,
|
||||
manual_reserve = min(
|
||||
raw_manual_reserve,
|
||||
max(30, math.ceil(daily_attempts * 0.1)),
|
||||
)
|
||||
available_auto_attempts = max(0, daily_attempts - manual_reserve)
|
||||
(
|
||||
relogin_protected_limit,
|
||||
lease_refresh_limit,
|
||||
relogin_high_limit,
|
||||
relogin_ordinary_limit,
|
||||
onboarding_attempts,
|
||||
) = _fit_priority_budgets(
|
||||
raw_relogin_limits,
|
||||
available_relogin_attempts,
|
||||
raw_priority_limits,
|
||||
available_auto_attempts,
|
||||
)
|
||||
hourly_attempts = max(1, math.ceil(daily_attempts / ASSUMED_ACTIVE_HOURS))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user