Fix: detect dead WebSocket connection and trigger reconnection
This commit is contained in:
@ -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]}")
|
||||||
|
|||||||
Reference in New Issue
Block a user