summaryrefslogtreecommitdiff
path: root/app/jobs.py
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-08 14:29:21 -0500
committerChristian Cleberg <[email protected]>2026-04-08 14:29:21 -0500
commita7c25076d16bde9ec928b9ef01bce952406ea7b1 (patch)
tree802c5f84902f240c6aab95acc1e6348dfbd806c2 /app/jobs.py
downloadhutch-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.py16
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)