Skip to content

Commit d399d76

Browse files
Move start_doing_background_updates() to SynapseHomeServer.start_background_tasks() (#19036)
(more sane standard location for this sort of thing) The one difference here is that previously, `start_doing_background_updates ()` only ran on the main Synapse instance. But since it now lives in `start_background_tasks()`, it will run on the worker that supposed to `run_background_tasks`. Doesn't seem like a problem though.
1 parent 9d9275d commit d399d76

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

changelog.d/19036.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Move `start_doing_background_updates()` to `SynapseHomeServer.start_background_tasks()`.

synapse/app/homeserver.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,11 @@ def start_listening(self) -> None:
317317
# during parsing
318318
logger.warning("Unrecognized listener type: %s", listener.type)
319319

320+
def start_background_tasks(self) -> None:
321+
super().start_background_tasks()
322+
323+
self.get_datastores().main.db_pool.updates.start_doing_background_updates()
324+
320325

321326
def load_or_generate_config(argv_options: List[str]) -> HomeServerConfig:
322327
"""
@@ -430,11 +435,6 @@ async def _start_when_reactor_running() -> None:
430435

431436
await _base.start(hs, freeze)
432437

433-
# TODO: This should be moved to `SynapseHomeServer.start_background_tasks` (not
434-
# `HomeServer.start_background_tasks`) (this way it matches the behavior of only
435-
# running on `main`)
436-
hs.get_datastores().main.db_pool.updates.start_doing_background_updates()
437-
438438
# Register a callback to be invoked once the reactor is running
439439
register_start(hs, _start_when_reactor_running)
440440

0 commit comments

Comments
 (0)