diff --git a/appdaemon/utils.py b/appdaemon/utils.py index a15734523..79d7ce511 100644 --- a/appdaemon/utils.py +++ b/appdaemon/utils.py @@ -18,6 +18,7 @@ from functools import wraps from appdaemon.version import __version__ # noqa: F401 from collections.abc import Iterable +import concurrent.futures if platform.system() != "Windows": import pwd @@ -343,7 +344,7 @@ def run_coroutine_threadsafe(self, coro): future = asyncio.run_coroutine_threadsafe(coro, self.AD.loop) try: result = future.result(self.AD.internal_function_timeout) - except asyncio.TimeoutError: + except (asyncio.TimeoutError, concurrent.futures.TimeoutError): if hasattr(self, "logger"): self.logger.warning( "Coroutine (%s) took too long (%s seconds), cancelling the task...", diff --git a/docs/HISTORY.rst b/docs/HISTORY.rst index 21442864a..9bede9911 100644 --- a/docs/HISTORY.rst +++ b/docs/HISTORY.rst @@ -25,6 +25,7 @@ Change Log - Fixed issue whereby `.git` paths where being imported into AD and leading to lots of unnecessary messages. - Fixed issue with AD being unable to refresh Plugin's entities - Fixed issue with using the `loop` in sequences for certain services +- Fixed issue whereby the wrong the wrong timeout error was being captured, when running a coroutine - Documentation fixes - contributed by `markwmuller `__ - Documentation fixes - contributed by `JonasPed `__ - Documentation fixes - contributed by `elandt `__