summary refs log tree commit diff
path: root/synapse/module_api/__init__.py
diff options
context:
space:
mode:
authorSean Quah <8349537+squahtx@users.noreply.github.com>2021-12-07 11:41:31 +0000
committerGitHub <noreply@github.com>2021-12-07 11:41:31 +0000
commiteccc49d7554d1fab001e1fefb0fda8ffb254b630 (patch)
tree1fee6bcbab0aa116820614961a9b275839b47b7a /synapse/module_api/__init__.py
parentFix 'delete room' admin api to work on incomplete rooms (#11523) (diff)
downloadsynapse-eccc49d7554d1fab001e1fefb0fda8ffb254b630.tar.xz
Fix `ModuleApi.looping_background_call` for non-async functions (#11524)
After #10847, `looping_background_call` would print an error in the logs
every time a non-async function was called. Since the error would be
caught and ignored immediately, there were no other side effects.
Diffstat (limited to '')
-rw-r--r--synapse/module_api/__init__.py5
1 files changed, 2 insertions, 3 deletions
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(