From c2bdaea84a8928c420f36b6e59e5e7fff2362417 Mon Sep 17 00:00:00 2001 From: Timothy Pogue Date: Wed, 2 Nov 2022 14:19:08 -0600 Subject: [PATCH] change exception handling in channel send --- freqtrade/rpc/api_server/ws/channel.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/freqtrade/rpc/api_server/ws/channel.py b/freqtrade/rpc/api_server/ws/channel.py index ec1b4c639..f9de1c6a0 100644 --- a/freqtrade/rpc/api_server/ws/channel.py +++ b/freqtrade/rpc/api_server/ws/channel.py @@ -79,7 +79,9 @@ class WebSocketChannel: timeout=self.drain_timeout ) return True - except asyncio.TimeoutError: + except Exception: + # We must catch any exception here to prevent an exception bubbling + # up and stalling the broadcast thread return False async def recv(self): @@ -135,11 +137,14 @@ class WebSocketChannel: as a task. """ while not self._closed.is_set(): + logger.info(f"{self} Relay - queue.get") message = await self.queue.get() try: + logger.info(f"{self} Relay - sending message") await self._send(message) self.queue.task_done() + logger.info(f"{self} Relay - QSize: {self.queue.qsize()}") # Limit messages per sec. # Could cause problems with queue size if too low, and # problems with network traffik if too high.