This commit is contained in:
2026-01-15 18:08:08 +08:00
parent 5586e98e51
commit 4a51ec89cc
21 changed files with 184 additions and 72 deletions

View File

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

View File

@@ -1,9 +1,12 @@
from fastscheduler import FastScheduler
from service import get_wecom
scheduler = FastScheduler(quiet=True)
@scheduler.every(10).seconds
def background_task():
print("Background work")
@scheduler.every(4).hours
async def background_task():
wecom = get_wecom()
await wecom.get_departments()