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])
|
||||
|
||||
Reference in New Issue
Block a user