Skip to content

Commit

Permalink
trying to catch and restart websocket closed exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
hscott-yuma committed Dec 6, 2024
1 parent 781080f commit 2d616c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions precog/validators/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 2d616c3

Please sign in to comment.