fix: Bridge _send_to_rvs ping-check before send, force reconnect on zombie
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+15
-1
@@ -1354,10 +1354,24 @@ class ARIABridge:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
async def _send_to_rvs(self, message: dict) -> None:
|
async def _send_to_rvs(self, message: dict) -> None:
|
||||||
"""Sendet eine Nachricht an die App (via RVS)."""
|
"""Sendet eine Nachricht an die App (via RVS) mit Verbindungs-Check."""
|
||||||
if self.ws_rvs is None:
|
if self.ws_rvs is None:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Ping-Check: Verbindung wirklich aktiv?
|
||||||
|
try:
|
||||||
|
pong = await self.ws_rvs.ping()
|
||||||
|
await asyncio.wait_for(pong, timeout=5)
|
||||||
|
except Exception:
|
||||||
|
logger.warning("[rvs] Ping fehlgeschlagen — Verbindung tot, erzwinge Reconnect")
|
||||||
|
try:
|
||||||
|
await self.ws_rvs.close()
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
self.ws_rvs = None
|
||||||
|
# Reconnect wird vom connect_to_rvs Loop uebernommen
|
||||||
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.ws_rvs.send(json.dumps(message))
|
await self.ws_rvs.send(json.dumps(message))
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Reference in New Issue
Block a user