refactor(task): move schedulers and startup/shutdown task into tasks directory

This commit is contained in:
MingxuanGame
2025-10-03 10:15:22 +00:00
parent afd5018bcd
commit fce88272b5
26 changed files with 464 additions and 480 deletions

View File

@@ -0,0 +1,21 @@
from __future__ import annotations
from datetime import datetime, timedelta
from app.dependencies.scheduler import get_scheduler
from app.service.beatmapset_update_service import service
from app.utils import bg_tasks
SCHEDULER_INTERVAL_MINUTES = 2
@get_scheduler().scheduled_job(
"interval",
id="update_beatmaps",
minutes=SCHEDULER_INTERVAL_MINUTES,
next_run_time=datetime.now() + timedelta(minutes=1),
)
async def beatmapset_update_job():
if service is not None:
bg_tasks.add_task(service.add_missing_beatmapsets)
await service._update_beatmaps()