feat(vessels): VesselAPI quota-capped AIS poller for Middle East blind spot
Add a server-side REST poller for VesselAPI (free tier 150 calls/mo) that upserts last-known positions into the shared vessel_last_known store when AISStream is unset. Default box is the Strait of Hormuz (span 3.6 <= 4 deg), never CONUS/NC (AISStream owns US coasts). - app/vesselapi.py: worker loop, 4deg span validator, position->marker transform (skip suspected_glitch), durable Postgres daily-quota table. - Local hard cap 5 successful 2xx/UTC day (VESSELAPI_MAX_CALLS_PER_DAY), monthly floor from X-RateLimit-Remaining, single request limit=50, no nextToken, no filter.sat, no retry-storm. - keystore VESSELAPI_API_KEY registry entry; config + compose env passthrough (app + ingest); wired next to AISStream in main.py lifespan + run_ingester. - GET /api/vessels docstring notes AISStream and/or VesselAPI cache. - tests/test_vesselapi.py: 20 unit tests (no network/DB).
This commit is contained in:
parent
30a9c9e9b1
commit
1f23083351
8 changed files with 806 additions and 3 deletions
|
|
@ -24,7 +24,7 @@ import sys
|
|||
|
||||
sys.path.insert(0, sys_path)
|
||||
|
||||
from config import NATS_URL, FIRMS_INTERVAL, FIRMS_DATASET, AISSTREAM_IN_INGEST # noqa: E402
|
||||
from config import NATS_URL, FIRMS_INTERVAL, FIRMS_DATASET, AISSTREAM_IN_INGEST, VESSELAPI_IN_INGEST # noqa: E402
|
||||
from sources import ingest_rss_feed, ingest_gdelt, ingest_earthquakes, ingest_eonet, ingest_cisa_kev # noqa: E402
|
||||
from fire_sources import ingest_fires # noqa: E402
|
||||
from ingestor import ingest_event, start_nats_consumer # noqa: E402
|
||||
|
|
@ -134,6 +134,9 @@ async def main() -> None:
|
|||
if AISSTREAM_IN_INGEST:
|
||||
from ais_stream import run_ais_worker # noqa: E402
|
||||
tasks.append(asyncio.create_task(run_ais_worker()))
|
||||
if VESSELAPI_IN_INGEST:
|
||||
from vesselapi import run_vesselapi_worker # noqa: E402
|
||||
tasks.append(asyncio.create_task(run_vesselapi_worker()))
|
||||
await asyncio.gather(producer_loop(), consumer_loop(), *tasks)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue