新增定时任务

This commit is contained in:
2026-09-03 15:47:50 +08:00
parent a9752b01a9
commit 7cdfd76bfb
10 changed files with 516 additions and 25 deletions
+4
View File
@@ -14,6 +14,7 @@ from loguru import logger
from .config import settings
from .database import engine
from .scheduler import start_scheduler, stop_scheduler
from .routers import register, resumes, sessions, jobs, blacklist, rpa, templates, ai
@@ -25,7 +26,10 @@ async def lifespan(app: FastAPI):
logger.success("数据库连接成功")
except Exception as e:
logger.error(f"数据库连接失败,请检查配置及数据库是否已初始化:{e}")
# 定时任务调度器:后台循环扫描 rpa_schedule,到点自动下发 RpaTask
sched_task = start_scheduler()
yield
await stop_scheduler(sched_task)
app = FastAPI(