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.
This commit is contained in:
Eric Eastwood 2025-10-10 14:30:38 -05:00 committed by GitHub
parent 9d9275da5a
commit d399d7649a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

1
changelog.d/19036.misc Normal file
View File

@ -0,0 +1 @@
Move `start_doing_background_updates()` to `SynapseHomeServer.start_background_tasks()`.

View File

@ -317,6 +317,11 @@ class SynapseHomeServer(HomeServer):
# during parsing
logger.warning("Unrecognized listener type: %s", listener.type)
def start_background_tasks(self) -> None:
super().start_background_tasks()
self.get_datastores().main.db_pool.updates.start_doing_background_updates()
def load_or_generate_config(argv_options: List[str]) -> HomeServerConfig:
"""
@ -430,11 +435,6 @@ def setup(
await _base.start(hs, freeze)
# TODO: This should be moved to `SynapseHomeServer.start_background_tasks` (not
# `HomeServer.start_background_tasks`) (this way it matches the behavior of only
# running on `main`)
hs.get_datastores().main.db_pool.updates.start_doing_background_updates()
# Register a callback to be invoked once the reactor is running
register_start(hs, _start_when_reactor_running)