Use non-blocking pipe reads and raw-stream telemetry for Morse

This commit is contained in:
Smittix
2026-02-26 16:02:10 +00:00
parent 64f0e687a0
commit 8cb7edf41e
2 changed files with 51 additions and 2 deletions
+5
View File
@@ -544,6 +544,7 @@ def start_morse() -> Response:
stop_event = threading.Event()
control_queue = queue.Queue(maxsize=16)
pcm_ready_event = threading.Event()
stream_ready_event = threading.Event()
attempt_stderr_lines: list[str] = []
def monitor_stderr(
@@ -598,6 +599,7 @@ def start_morse() -> Response:
'decoder_config': runtime_config,
'control_queue': control_queue,
'pcm_ready_event': pcm_ready_event,
'stream_ready_event': stream_ready_event,
},
daemon=True,
name='morse-decoder',
@@ -617,6 +619,7 @@ def start_morse() -> Response:
'decoder_config': runtime_config,
'control_queue': control_queue,
'pcm_ready_event': pcm_ready_event,
'stream_ready_event': stream_ready_event,
'strip_text_chunks': False,
},
daemon=True,
@@ -642,6 +645,8 @@ def start_morse() -> Response:
startup_error = 'No PCM samples received within startup timeout'
if attempt_stderr_lines:
startup_error = f'{startup_error}; stderr: {attempt_stderr_lines[-1]}'
if stream_ready_event.is_set():
startup_error = f'{startup_error}; stream=alive'
is_last_attempt = attempt_index == len(command_attempts)
if (