perf(account): 提升能力补扫与登录恢复吞吐
This commit is contained in:
@@ -48,14 +48,18 @@ def _account(
|
||||
)
|
||||
|
||||
|
||||
def _presale_task(account: Account, *, execution_status: str = "bound") -> PlatformFulfillmentTask:
|
||||
def _presale_task(
|
||||
account: Account, *, execution_status: str = "bound"
|
||||
) -> PlatformFulfillmentTask:
|
||||
return PlatformFulfillmentTask(
|
||||
source_order_id=f"order-{account.id or account.username}",
|
||||
source_order_item_id=f"item-{account.id or account.username}",
|
||||
sale_mode="presale",
|
||||
account_id=account.id,
|
||||
binding_status=(
|
||||
"bound" if execution_status not in {"completed", "cancelled"} else "not_started"
|
||||
"bound"
|
||||
if execution_status not in {"completed", "cancelled"}
|
||||
else "not_started"
|
||||
),
|
||||
execution_status=execution_status,
|
||||
)
|
||||
@@ -207,9 +211,7 @@ def test_protection_target_reports_ck_health_and_shortage(db):
|
||||
assert presale["ck_invalid"] == 1
|
||||
assert presale["target_shortage"] == 2
|
||||
assert presale["needs_attention"] is True
|
||||
assert {
|
||||
alert["code"] for alert in status["alerts"]
|
||||
} >= {
|
||||
assert {alert["code"] for alert in status["alerts"]} >= {
|
||||
"account_protection_ck_affected",
|
||||
"account_protection_target_shortage",
|
||||
}
|
||||
@@ -563,7 +565,7 @@ def test_cascading_priority_quota_reservation_p0_p1_p2_p3(db):
|
||||
ck_status="valid",
|
||||
checked_at=NOW,
|
||||
)
|
||||
p1.cookie_updated_at = NOW - timedelta(days=6, hours=20)
|
||||
p1.cookie_updated_at = NOW - timedelta(days=6, hours=23)
|
||||
p2 = _account("tier-p2", ck_status="invalid", points=500)
|
||||
p3 = _account("tier-p3", ck_status="invalid", points=0)
|
||||
db.add_all([p0, p1, p2, p3])
|
||||
|
||||
@@ -31,7 +31,7 @@ def test_list_jobs_registers_default_jobs_when_api_process_registry_is_empty(db)
|
||||
keys = set(jobs)
|
||||
assert "account_sync_queue" in keys
|
||||
assert "account_supply_replenishment" in keys
|
||||
assert jobs["account_sync_queue"]["batch_size"] == 40
|
||||
assert jobs["account_sync_queue"]["batch_size"] == 60
|
||||
assert result["scheduler"]["enabled"] is not None
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ TESTS_DIR = Path(__file__).resolve().parent
|
||||
PROJECT_ROOT = TESTS_DIR.parent
|
||||
VERSIONS_DIR = PROJECT_ROOT / "web" / "backend" / "migrations" / "versions"
|
||||
|
||||
HEAD_REVISION = "20261128_0138"
|
||||
HEAD_REVISION = "20261128_0139"
|
||||
|
||||
# 迁移新增、但不声明在模型里的复合查询索引。
|
||||
EXTRA_INDEXES = (
|
||||
|
||||
Reference in New Issue
Block a user