Feat: APScheduler — täglich Push für Health-Erinnerungen
- apscheduler==3.10.4 in requirements.txt - scheduler.py: AsyncIOScheduler, täglich 08:00 Uhr (Europe/Berlin) - Job prüft naechstes IN (heute, in 7 Tagen, gestern): heute → "Heute fällig", 7 Tage → Vorwarnung, gestern → Überfällig - Nur Impfung, Entwurmung, Medikament - misfire_grace_time=3600 (robust nach Container-Neustart) - Scheduler start/stop im FastAPI lifespan
This commit is contained in:
parent
c721d051c8
commit
5518064be3
3 changed files with 93 additions and 0 deletions
|
|
@ -11,6 +11,7 @@ from contextlib import asynccontextmanager
|
|||
|
||||
from database import init_db
|
||||
import ki
|
||||
import scheduler as sched
|
||||
|
||||
logging.basicConfig(
|
||||
level = logging.INFO,
|
||||
|
|
@ -27,7 +28,9 @@ async def lifespan(app: FastAPI):
|
|||
logger.info("Ban Yaro startet...")
|
||||
init_db()
|
||||
logger.info(f"KI-Modus: {ki.KI_MODE}")
|
||||
sched.start()
|
||||
yield
|
||||
sched.stop()
|
||||
logger.info("Ban Yaro beendet.")
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue