Catch status code errors

This commit is contained in:
Timothy Pogue 2022-08-27 00:06:03 -06:00
parent fcceb744c5
commit 05ca673883

View File

@ -437,12 +437,12 @@ class ExternalSignalController(RPCHandler):
# as we might call the RPC module in the main thread # as we might call the RPC module in the main thread
await self._handle_leader_message(data) await self._handle_leader_message(data)
except socket.gaierror: except (socket.gaierror, ConnectionRefusedError):
logger.info(f"Socket error - retrying connection in {self.sleep_time}s") logger.info(f"Connection Refused - retrying connection in {self.sleep_time}s")
await asyncio.sleep(self.sleep_time) await asyncio.sleep(self.sleep_time)
continue continue
except ConnectionRefusedError: except websockets.exceptions.InvalidStatusCode as e:
logger.info(f"Connection Refused - retrying connection in {self.sleep_time}s") logger.error(f"Connection Refused - {e}")
await asyncio.sleep(self.sleep_time) await asyncio.sleep(self.sleep_time)
continue continue