perf(douyu): 优化慢查询并修复供应商充值收口
This commit is contained in:
@@ -84,14 +84,6 @@ def build_select_query(
|
||||
)
|
||||
|
||||
|
||||
def count_remaining(
|
||||
db: Session,
|
||||
*,
|
||||
now: datetime | None = None,
|
||||
) -> int:
|
||||
return _base_query(db, now or datetime.now(UTC)).count()
|
||||
|
||||
|
||||
def run_account_capability_refresh(
|
||||
db: Session,
|
||||
job: AutomationJob,
|
||||
@@ -103,7 +95,9 @@ def run_account_capability_refresh(
|
||||
job,
|
||||
accounts,
|
||||
now=now,
|
||||
remaining_count=count_remaining(db, now=now),
|
||||
# 精确剩余量要完整评估 accounts × commodity EXISTS,生产实测单次约
|
||||
# 1.3 秒、扫描 38 万行;它只用于展示,直接省略,避免每轮制造慢查询。
|
||||
remaining_count=None,
|
||||
source="capability_demand_refresh",
|
||||
log_label="capability",
|
||||
empty_message="当前履约商品没有到期待刷新的账号能力",
|
||||
@@ -113,6 +107,5 @@ def run_account_capability_refresh(
|
||||
__all__ = [
|
||||
"JOB_KEY",
|
||||
"build_select_query",
|
||||
"count_remaining",
|
||||
"run_account_capability_refresh",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user