fix(platform): 防止绑定任务压垮连接池和事件循环

This commit is contained in:
yml
2026-11-21 15:22:46 +08:00
parent d199e04d27
commit e1d979a296
13 changed files with 336 additions and 46 deletions
+19
View File
@@ -270,6 +270,18 @@ class Account(Base):
Index("ix_accounts_status", "status"),
# 高价值三态的过期判定和待刷新筛选
Index("ix_accounts_high_value_checked_at", "high_value_checked_at"),
# 账号池选号:先按自动管理/生命周期过滤,再按 CK、积分和到期时间排序。
# 这条索引避免每次选号都回表扫描全部账号后再排序。
Index(
"ix_accounts_pool_candidate",
"auto_managed",
"status",
"role_change_available_at",
"ck_check_status",
"points_expire_at",
"points",
"id",
),
)
assigned_user: Mapped[User | None] = relationship(
@@ -800,6 +812,13 @@ class DouyuExternalOrder(Base):
"source_task_id",
unique=True,
),
# 账号池排除活动协作单的 NOT EXISTS 每轮都会执行。
Index(
"ix_douyu_external_orders_active_account",
"account_id",
"archived_at",
"status",
),
)