From 2d616c34d01ea51a9670dae00595e6acd0eca7ce Mon Sep 17 00:00:00 2001 From: hscott Date: Fri, 6 Dec 2024 10:40:46 -0500 Subject: [PATCH] trying to catch and restart websocket closed exceptions --- precog/validators/validator.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/precog/validators/validator.py b/precog/validators/validator.py index d09c2c2..79aae3c 100755 --- a/precog/validators/validator.py +++ b/precog/validators/validator.py @@ -2,6 +2,7 @@ from pathlib import Path import bittensor as bt +import websocket from precog.utils.classes import Config from precog.utils.general import parse_arguments @@ -27,6 +28,9 @@ async def main(self): except BrokenPipeError: bt.logging.error("Recieved a Broken Pipe substrate error") asyncio.run(self.reset_instance()) + except websocket._exceptions.WebSocketConnectionClosedException: + bt.logging.error("Recieved a websocket closed error, restarting validator") + asyncio.run(self.reset_instance()) except Exception as e: bt.logging.error(f"Unhandled exception: {e}") finally: