diff options
| author | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-08 14:29:21 -0500 |
| commit | a7c25076d16bde9ec928b9ef01bce952406ea7b1 (patch) | |
| tree | 802c5f84902f240c6aab95acc1e6348dfbd806c2 /app/jobs.py | |
| download | hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.gz hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.tar.bz2 hutch-notify-a7c25076d16bde9ec928b9ef01bce952406ea7b1.zip | |
initial commit
Diffstat (limited to 'app/jobs.py')
| -rw-r--r-- | app/jobs.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/app/jobs.py b/app/jobs.py new file mode 100644 index 0000000..4ad4d40 --- /dev/null +++ b/app/jobs.py @@ -0,0 +1,16 @@ +from apscheduler.schedulers.asyncio import AsyncIOScheduler +from app.config import settings +from app.db import SessionLocal +from app.poller import poll_builds_once + +scheduler = AsyncIOScheduler() + + +def start_scheduler() -> None: + scheduler.add_job(run_build_poll, "interval", seconds=settings.poll_interval_seconds, id="build-poll", replace_existing=True) + scheduler.start() + + +async def run_build_poll() -> None: + async with SessionLocal() as db: + await poll_builds_once(db) |
