Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit a6c98fe

Browse files
author
Sean Quah
committed
Fix ModuleApi.looping_background_call for non-async functions
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.
1 parent 2f053f3 commit a6c98fe

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

changelog.d/11523.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
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.

synapse/module_api/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
create_requester,
109109
)
110110
from synapse.util import Clock
111+
from synapse.util.async_helpers import maybe_awaitable
111112
from synapse.util.caches.descriptors import cached
112113

113114
if TYPE_CHECKING:
@@ -1014,9 +1015,7 @@ def looping_background_call(
10141015
run_as_background_process,
10151016
msec,
10161017
desc,
1017-
f,
1018-
*args,
1019-
**kwargs,
1018+
lambda: maybe_awaitable(f(*args, **kwargs)),
10201019
)
10211020
else:
10221021
logger.warning(

0 commit comments

Comments
 (0)