From 54280ee35c8d060375eb642c4f702695a5da94dc Mon Sep 17 00:00:00 2001 From: Ichinga Samuel Date: Thu, 6 Feb 2025 22:22:22 +0100 Subject: [PATCH] v4.0.11 --- pyproject.toml | 2 +- src/aiomql/lib/executor.py | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 6352253..51b5784 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "aiomql" -version = "4.0.10" +version = "4.0.11" readme = "README.md" requires-python = ">=3.11" classifiers = [ diff --git a/src/aiomql/lib/executor.py b/src/aiomql/lib/executor.py index 98b5f7b..f3145e4 100644 --- a/src/aiomql/lib/executor.py +++ b/src/aiomql/lib/executor.py @@ -71,8 +71,11 @@ class Executor: async def run_coroutine_tasks(self): """Run all coroutines in the executor""" - await asyncio.gather(*[coroutine(**kwargs) for coroutine, kwargs in self.coroutines.items()], - return_exceptions=True) + try: + await asyncio.gather(*[coroutine(**kwargs) for coroutine, kwargs in self.coroutines.items()], + return_exceptions=True) + except Exception as err: + logger.error("%s: Error occurred in run_coroutine_tasks", err) @staticmethod def run_coroutine_task(coroutine, kwargs): @@ -98,18 +101,14 @@ class Executor: if self.timeout is not None and self.timeout < (asyncio.get_event_loop().time() - start): self.config.shutdown = True break - - timeout = 1 if self.timeout else 30 + timeout = self.timeout or 1 await asyncio.sleep(timeout) - for strategy in self.strategy_runners: strategy.running = False - self.config.task_queue.cancel() if self.config.backtest_engine is not None: self.config.backtest_engine.stop_testing = True - self.executor.shutdown(wait=False, cancel_futures=False) if self.config.force_shutdown: