Fix: detect dead WebSocket connection and trigger reconnection

This commit is contained in:
DiTus
2026-08-05 20:26:43 +02:00
parent 0c9dbf43ac
commit 716b54fc67

View File

@ -164,6 +164,8 @@ class LiveCandleFetcher:
while True: while True:
try: try:
time.sleep(1) time.sleep(1)
if not self.info.ws_manager.is_alive():
raise ConnectionError("WebSocket connection is not alive")
if time.time() - self._last_status_log >= 300: if time.time() - self._last_status_log >= 300:
if self._last_candle_info: if self._last_candle_info:
logging.info(f"LiveCandleFetcher running correctly. Last 1m candle collected: {self._last_candle_info[0]} at {self._last_candle_info[1]}") logging.info(f"LiveCandleFetcher running correctly. Last 1m candle collected: {self._last_candle_info[0]} at {self._last_candle_info[1]}")