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

Commit

Permalink
Fix ModuleApi.looping_background_call for non-async functions (#11524)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
squahtx authored Dec 7, 2021
1 parent b1ecd19 commit eccc49d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions changelog.d/11524.bugfix
Original file line number Diff line number Diff line change
@@ -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.
5 changes: 2 additions & 3 deletions synapse/module_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
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:
Expand Down Expand Up @@ -1014,9 +1015,7 @@ def looping_background_call(
run_as_background_process,
msec,
desc,
f,
*args,
**kwargs,
lambda: maybe_awaitable(f(*args, **kwargs)),
)
else:
logger.warning(
Expand Down

0 comments on commit eccc49d

Please sign in to comment.