From 03c5d33eb763d38d3e12dad1d4995d151588cf49 Mon Sep 17 00:00:00 2001 From: Mitch Ross Date: Sat, 7 Feb 2026 15:28:07 -0500 Subject: [PATCH] Fix race condition: set _running before starting reader thread The reader thread loop checks self._running but it was being set to True after _start_satdump() returned, which is after the thread already started. The thread would see _running=False and exit immediately without reading any SatDump output. Co-Authored-By: Claude Opus 4.6 --- utils/weather_sat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/weather_sat.py b/utils/weather_sat.py index 34df3b1..0137597 100644 --- a/utils/weather_sat.py +++ b/utils/weather_sat.py @@ -252,8 +252,8 @@ class WeatherSatDecoder: self._capture_phase = 'tuning' try: - self._start_satdump(sat_info, device_index, gain, sample_rate, bias_t) self._running = True + self._start_satdump(sat_info, device_index, gain, sample_rate, bias_t) logger.info( f"Weather satellite capture started: {satellite} " @@ -272,6 +272,7 @@ class WeatherSatDecoder: return True except Exception as e: + self._running = False logger.error(f"Failed to start weather satellite capture: {e}") self._emit_progress(CaptureProgress( status='error',