添加定时任务配置

This commit is contained in:
2026-01-15 11:10:19 +08:00
parent a3107403d8
commit 1e8ae960cd
6 changed files with 43 additions and 2 deletions

7
scheduler/__init__.py Normal file
View File

@@ -0,0 +1,7 @@
from fastapi import FastAPI
from fastscheduler.fastapi_integration import create_scheduler_routes
from scheduler.scheduler import scheduler
def init_scheduler_router(app : FastAPI):
app.include_router(create_scheduler_routes(scheduler))
scheduler.start()

View File

@@ -0,0 +1,9 @@
from fastscheduler import FastScheduler
scheduler = FastScheduler(quiet=True)
@scheduler.every(10).seconds
def background_task():
print("Background work")