diff options
-rw-r--r-- | changelog.d/11524.bugfix | 1 | ||||
-rw-r--r-- | synapse/module_api/__init__.py | 5 |
2 files changed, 3 insertions, 3 deletions
diff --git a/changelog.d/11524.bugfix b/changelog.d/11524.bugfix new file mode 100644 index 0000000000..6e1e4bd44c --- /dev/null +++ b/changelog.d/11524.bugfix @@ -0,0 +1 @@ +Fix a regression in Synapse 1.48.0 where the module API's `looping_background_call` method would spam errors to the logs when given a non-async function. diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 6bfb4b8d1b..662e60bc33 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -108,6 +108,7 @@ from synapse.types import ( create_requester, ) from synapse.util import Clock +from synapse.util.async_helpers import maybe_awaitable from synapse.util.caches.descriptors import cached if TYPE_CHECKING: @@ -1014,9 +1015,7 @@ class ModuleApi: run_as_background_process, msec, desc, - f, - *args, - **kwargs, + lambda: maybe_awaitable(f(*args, **kwargs)), ) else: logger.warning( |