Skip to content

Commit

Permalink
fixed unhandled websockets error in agent
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Sep 25, 2023
1 parent aaa3aba commit 7ea2311
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion bbot/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ async def ws(self, rebuild=False):
verbs = ("Rebuilding", "Rebuilt")
url = f"{self.url}/control/"
log.debug(f"{verbs[0]} websocket connection to {url}")
self._ws = await websockets.connect(url, **kwargs)
while 1:
try:
self._ws = await websockets.connect(url, **kwargs)
break
except Exception as e:
log.error(f'Failed to establish websockets connection to URL "{url}": {e}')
log.trace(traceback.format_exc())
await asyncio.sleep(1)
log.debug(f"{verbs[1]} websocket connection to {url}")
return self._ws

Expand Down

0 comments on commit 7ea2311

Please sign in to comment.