krz/hutch-notify
Notification server for Hutch.
clone: git clone https://gitbay.org/krz/hutch-notify.git
1from apscheduler.schedulers.asyncio import AsyncIOScheduler
2from app.config import settings
3from app.db import SessionLocal
4from app.poller import poll_builds_once
5
6scheduler = AsyncIOScheduler()
7
8
9def start_scheduler() -> None:
10 scheduler.add_job(run_build_poll, "interval", seconds=settings.poll_interval_seconds, id="build-poll", replace_existing=True)
11 scheduler.start()
12
13
14async def run_build_poll() -> None:
15 async with SessionLocal() as db:
16 await poll_builds_once(db)