merge master: keep VesselAPI env and self-hosted TiTiler in compose
PR #20 conflicted on docker-compose.yml after #19 landed. App service now passes both VESSELAPI_* and TITILER_* ; titiler stays on 127.0.0.1:8001.
This commit is contained in:
commit
d09009e0bf
9 changed files with 866 additions and 5 deletions
17
app/main.py
17
app/main.py
|
|
@ -72,18 +72,26 @@ async def _lifespan(app: FastAPI):
|
|||
await refresh_cache()
|
||||
except Exception:
|
||||
pass
|
||||
from config import AISSTREAM_IN_APP
|
||||
from config import AISSTREAM_IN_APP, VESSELAPI_IN_APP
|
||||
ais_task = None
|
||||
vesselapi_task = None
|
||||
adsb_task = None
|
||||
if AISSTREAM_IN_APP:
|
||||
from ais_stream import run_ais_worker
|
||||
ais_task = asyncio.create_task(run_ais_worker())
|
||||
if VESSELAPI_IN_APP:
|
||||
from vesselapi import run_vesselapi_worker
|
||||
vesselapi_task = asyncio.create_task(run_vesselapi_worker())
|
||||
adsb_task = asyncio.create_task(_adsb_refresh_loop())
|
||||
yield
|
||||
if ais_task is not None:
|
||||
ais_task.cancel()
|
||||
if vesselapi_task is not None:
|
||||
vesselapi_task.cancel()
|
||||
if adsb_task is not None:
|
||||
adsb_task.cancel()
|
||||
from vesselapi import close_client
|
||||
await close_client()
|
||||
await close_http()
|
||||
|
||||
|
||||
|
|
@ -1492,7 +1500,12 @@ async def list_vessels(
|
|||
limit: int = Query(2000, ge=1, le=5000),
|
||||
timestamp: str | None = Query(None, description="ISO time — DVR 1-min tracks instead of live"),
|
||||
):
|
||||
"""AIS last-known from the server-side AISStream worker. Empty without a key."""
|
||||
"""AIS last-known — union of two independent providers.
|
||||
|
||||
AISStream (extra.src="aisstream", live US-coast WebSocket) and VesselAPI
|
||||
(extra.src="vesselapi", Strait of Hormuz 5×/day poll) both upsert into the
|
||||
same store. Empty without either key / until the first successful poll.
|
||||
"""
|
||||
if bbox:
|
||||
_parse_bbox_query(bbox)
|
||||
try:
|
||||
|
|
|
|||
Loading…
Reference in a new issue