From a386c654d3e96c591491c0b6cd8b9e4316ee6bf7 Mon Sep 17 00:00:00 2001 From: tazlin Date: Fri, 2 Feb 2024 09:25:20 -0500 Subject: [PATCH] fix: demote log errors on exit to debug --- horde_worker_regen/process_management/process_manager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/horde_worker_regen/process_management/process_manager.py b/horde_worker_regen/process_management/process_manager.py index 3452acd7..419b0fcc 100644 --- a/horde_worker_regen/process_management/process_manager.py +++ b/horde_worker_regen/process_management/process_manager.py @@ -2439,8 +2439,7 @@ async def _bridge_data_loop(self) -> None: except CancelledError: self._shutting_down = True - @staticmethod - def _handle_exception(future: asyncio.Future) -> None: + def _handle_exception(self, future: asyncio.Future) -> None: """ Logs exceptions from asyncio tasks. @@ -2449,7 +2448,10 @@ def _handle_exception(future: asyncio.Future) -> None: """ ex = future.exception() if ex is not None: - logger.error(f"exception thrown by a main loop task: {ex}") + if self._shutting_down: + logger.debug(f"exception thrown by a main loop task: {ex}") + else: + logger.error(f"exception thrown by a main loop task: {ex}") async def _main_loop(self) -> None: # Run both loops concurrently