From a7c25076d16bde9ec928b9ef01bce952406ea7b1 Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Wed, 8 Apr 2026 14:29:21 -0500 Subject: initial commit --- app/poller.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 app/poller.py (limited to 'app/poller.py') diff --git a/app/poller.py b/app/poller.py new file mode 100644 index 0000000..d08011f --- /dev/null +++ b/app/poller.py @@ -0,0 +1,20 @@ +from sqlalchemy import select +from sqlalchemy.ext.asyncio import AsyncSession +from app.models import Subscription, Event, Delivery, Device + + +async def poll_builds_once(db: AsyncSession) -> None: + # Placeholder. + # Replace with sr.ht fetch logic. + # Strategy: + # 1. query distinct build subscriptions + # 2. fetch latest builds per source_id + # 3. create Event rows for unseen terminal states + # 4. create Delivery rows for enabled devices subscribed to matching event_type + subscribed = await db.execute( + select(Subscription).where(Subscription.source_type == "build", Subscription.is_enabled.is_(True)) + ) + subscriptions = subscribed.scalars().all() + + # no-op until sr.ht integration is wired + _ = subscriptions -- cgit v1.2.3