fix: _send_to_rvs gibt Success-Bool zurueck, _stt_remote bricht bei

Send-Fehler sofort ab statt in den 45s-Timeout zu laufen.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
duffyduck 2026-04-24 14:16:08 +02:00
parent a1343ee18f
commit e170991222
1 changed files with 13 additions and 5 deletions

View File

@ -1452,7 +1452,7 @@ class ARIABridge:
model = getattr(self.stt_engine, "model_size", "small") model = getattr(self.stt_engine, "model_size", "small")
logger.info("[rvs] stt_request → whisper-bridge (id=%s, model=%s, %dKB)", logger.info("[rvs] stt_request → whisper-bridge (id=%s, model=%s, %dKB)",
request_id[:8], model, len(audio_b64) // 1365) request_id[:8], model, len(audio_b64) // 1365)
await self._send_to_rvs({ ok = await self._send_to_rvs({
"type": "stt_request", "type": "stt_request",
"payload": { "payload": {
"requestId": request_id, "requestId": request_id,
@ -1463,6 +1463,9 @@ class ARIABridge:
}, },
"timestamp": int(loop.time() * 1000), "timestamp": int(loop.time() * 1000),
}) })
if not ok:
logger.warning("[rvs] stt_request konnte nicht gesendet werden — skip Remote")
return None
return await asyncio.wait_for(future, timeout=self._STT_REMOTE_TIMEOUT_S) return await asyncio.wait_for(future, timeout=self._STT_REMOTE_TIMEOUT_S)
except asyncio.TimeoutError: except asyncio.TimeoutError:
logger.warning("[rvs] Remote-STT Timeout (%.0fs)", self._STT_REMOTE_TIMEOUT_S) logger.warning("[rvs] Remote-STT Timeout (%.0fs)", self._STT_REMOTE_TIMEOUT_S)
@ -1519,10 +1522,13 @@ class ARIABridge:
except OSError: except OSError:
pass pass
async def _send_to_rvs(self, message: dict) -> None: async def _send_to_rvs(self, message: dict) -> bool:
"""Sendet eine Nachricht an die App (via RVS) mit Verbindungs-Check.""" """Sendet eine Nachricht an die App (via RVS) mit Verbindungs-Check.
Rueckgabe: True wenn erfolgreich gesendet, False wenn Verbindung tot.
"""
if self.ws_rvs is None: if self.ws_rvs is None:
return return False
# Ping-Check: Verbindung wirklich aktiv? # Ping-Check: Verbindung wirklich aktiv?
try: try:
@ -1536,12 +1542,14 @@ class ARIABridge:
pass pass
self.ws_rvs = None self.ws_rvs = None
# Reconnect wird vom connect_to_rvs Loop uebernommen # Reconnect wird vom connect_to_rvs Loop uebernommen
return return False
try: try:
await self.ws_rvs.send(json.dumps(message)) await self.ws_rvs.send(json.dumps(message))
return True
except Exception: except Exception:
logger.warning("[rvs] Sendefehler — RVS nicht erreichbar") logger.warning("[rvs] Sendefehler — RVS nicht erreichbar")
return False
# ── Log-Streaming an die App ───────────────────────────── # ── Log-Streaming an die App ─────────────────────────────