From 81c90a9fafa59fc1e9e82da129070f6efba9b4af Mon Sep 17 00:00:00 2001 From: anoracleofra-code Date: Thu, 26 Mar 2026 10:53:30 -0600 Subject: [PATCH] fix: stop AIS proxy crash-loop when API key is not set Exit early from _ais_stream_loop() if AIS_API_KEY is empty instead of endlessly spawning the Node proxy which immediately prints FATAL and exits. This was flooding docker logs with hundreds of lines per minute. --- backend/services/ais_stream.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/services/ais_stream.py b/backend/services/ais_stream.py index 6d930aa..a85c571 100644 --- a/backend/services/ais_stream.py +++ b/backend/services/ais_stream.py @@ -487,6 +487,10 @@ def _ais_stream_loop(): proxy_script = os.path.join(os.path.dirname(os.path.dirname(__file__)), "ais_proxy.js") backoff = 1 # Exponential backoff starting at 1 second + if not API_KEY: + logger.info("AIS_API_KEY not set — ship tracking disabled. Set AIS_API_KEY to enable.") + return + while _ws_running: try: logger.info("Starting Node.js AIS Stream Proxy...")