feat(geofence): hear quakes, WFIGS incidents, and news pins
New hits carry a frozen evidence pack. adsb/ais/firms payloads stay unchanged, and cameras are never passed to record_and_notify.
This commit is contained in:
parent
d04ddc9afa
commit
d878655617
7 changed files with 990 additions and 26 deletions
|
|
@ -116,6 +116,24 @@ async def fire_loop() -> None:
|
|||
await asyncio.sleep(FIRMS_INTERVAL)
|
||||
|
||||
|
||||
async def geofence_feed_loop() -> None:
|
||||
"""Hear quakes already stored, WFIGS incidents, and news map pins.
|
||||
|
||||
WFIGS is not persisted — fetched per active-fence bbox here (no FIRMS
|
||||
or AIS key). News pins are read from ``news_items``; the summarizer
|
||||
is not imported. New earthquakes also notify from ``ingest_event``.
|
||||
"""
|
||||
logger.info("geofence feed loop starting (interval=%ss)", INTERVAL)
|
||||
while True:
|
||||
try:
|
||||
from geofence import scan_geofence_feeds
|
||||
n = await scan_geofence_feeds()
|
||||
logger.info("geofence feeds -> %d notifies", n)
|
||||
except Exception: # noqa: BLE001
|
||||
logger.exception("geofence feed scan failed")
|
||||
await asyncio.sleep(INTERVAL)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
logger.info(
|
||||
"ingester starting (rss=%d feeds, gdelt_q=%r, quakes=%s, fires=%s, interval=%ss)",
|
||||
|
|
@ -126,7 +144,9 @@ async def main() -> None:
|
|||
await refresh_cache()
|
||||
except Exception:
|
||||
logger.exception("geofence cache refresh failed (ST_Intersects still runs on ingest)")
|
||||
tasks: list[asyncio.Task] = []
|
||||
tasks: list[asyncio.Task] = [
|
||||
asyncio.create_task(geofence_feed_loop()),
|
||||
]
|
||||
if ENABLE_FIRES:
|
||||
# Fire ingest only starts once FIRMS_MAP_KEY is set (ingest_fires logs
|
||||
# and idles otherwise).
|
||||
|
|
|
|||
Loading…
Reference in a new issue