Fix silent watcher thread death with watchdog supervisor

Move time.sleep inside the try/except to catch BaseException-level
failures, and wrap the watcher thread in a supervisor that auto-restarts
it within 5s if it ever exits unexpectedly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
perco
2026-06-03 14:59:18 +02:00
co-authored by Claude Sonnet 4.6
parent 31bb5d86c6
commit ea4118ffcd
2 changed files with 13 additions and 3 deletions
+2 -1
View File
@@ -377,6 +377,7 @@ def run_watcher():
_last_event_time = now
log.info("Vehicle detected!")
_process_event()
time.sleep(POLL_INTERVAL)
except Exception as e:
log.error(f"Watcher loop error: {e}", exc_info=True)
time.sleep(POLL_INTERVAL)
time.sleep(POLL_INTERVAL)