feat(douyu): 建立账号同步队列与供给库存

This commit is contained in:
yml
2026-11-21 21:48:51 +08:00
parent 1d262cdfd9
commit 3baf15afda
16 changed files with 1158 additions and 33 deletions
+4
View File
@@ -58,6 +58,7 @@ async def lifespan(app: FastAPI):
from loguru import logger
from .database import SessionLocal, dispose_engines
from .services.account_work_queue import recover_running_account_work
from .services.douyu_service import cleanup_orphan_douyu_tasks
from .services.huya_service import cleanup_orphan_huya_tasks
from .services.login_quota_service import cleanup_orphan_login_attempts
@@ -88,6 +89,9 @@ async def lifespan(app: FastAPI):
cleaned_attempts = cleanup_orphan_login_attempts(db)
if cleaned_attempts:
logger.info(f"启动收敛中断的登录尝试流水: {cleaned_attempts} 条")
recovered_work = recover_running_account_work(db)
if recovered_work:
logger.info(f"启动恢复中断的账号内部工作项: {recovered_work} 条")
from .services.yyb_service import cleanup_orphan_yyb_tasks
cleaned_yyb = cleanup_orphan_yyb_tasks(db, message="任务已中断(服务重启)")