FastAPI service that subscribes to nearle/# on the MQTT broker and forwards rider status, periodic logs, and profile updates to the Jupiter webhook API. Includes fixes for a failure mode that took the bridge down silently for ~3.8 days in June 2026, during which it served HTTP 200 on / while forwarding zero events: - Retry MQTT connection with backoff instead of letting a single failed connect kill the background thread permanently. - Subscribe inside on_connect so subscriptions are restored after an automatic reconnect; the session is clean, so a reconnect previously came back subscribed to nothing. - Add /healthz returning 503 when MQTT is disconnected, so a monitor can distinguish a live bridge from a dead one. - Replace thread-per-message forwarding with a bounded worker pool, which keeps memory flat when the upstream API stalls on its 5s timeout. - Pin requirements.txt to the versions verified in production; it was unpinned and had already drifted to paho-mqtt 2.1.0. - Set PYTHONUNBUFFERED so container logs are not block-buffered. - Name the compose image nearle-api-image to match the deployed tag. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
34 B
34 B