mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:46:01 -04:00
Merge branch 'release-v1.41' into develop
This commit is contained in:
commit
78a70a2e0b
84 changed files with 807 additions and 951 deletions
|
@ -95,6 +95,7 @@ class ModuleApi:
|
|||
self._state = hs.get_state_handler()
|
||||
self._clock: Clock = hs.get_clock()
|
||||
self._send_email_handler = hs.get_send_email_handler()
|
||||
self.custom_template_dir = hs.config.server.custom_template_directory
|
||||
|
||||
try:
|
||||
app_name = self._hs.config.email_app_name
|
||||
|
@ -613,10 +614,15 @@ class ModuleApi:
|
|||
msec: float,
|
||||
*args,
|
||||
desc: Optional[str] = None,
|
||||
run_on_all_instances: bool = False,
|
||||
**kwargs,
|
||||
):
|
||||
"""Wraps a function as a background process and calls it repeatedly.
|
||||
|
||||
NOTE: Will only run on the instance that is configured to run
|
||||
background processes (which is the main process by default), unless
|
||||
`run_on_all_workers` is set.
|
||||
|
||||
Waits `msec` initially before calling `f` for the first time.
|
||||
|
||||
Args:
|
||||
|
@ -627,12 +633,14 @@ class ModuleApi:
|
|||
msec: How long to wait between calls in milliseconds.
|
||||
*args: Positional arguments to pass to function.
|
||||
desc: The background task's description. Default to the function's name.
|
||||
run_on_all_instances: Whether to run this on all instances, rather
|
||||
than just the instance configured to run background tasks.
|
||||
**kwargs: Key arguments to pass to function.
|
||||
"""
|
||||
if desc is None:
|
||||
desc = f.__name__
|
||||
|
||||
if self._hs.config.run_background_tasks:
|
||||
if self._hs.config.run_background_tasks or run_on_all_instances:
|
||||
self._clock.looping_call(
|
||||
run_as_background_process,
|
||||
msec,
|
||||
|
@ -689,7 +697,7 @@ class ModuleApi:
|
|||
"""
|
||||
return self._hs.config.read_templates(
|
||||
filenames,
|
||||
(td for td in (custom_template_directory,) if td),
|
||||
(td for td in (self.custom_template_dir, custom_template_directory) if td),
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue