From cfe28f2729b69c1948aea127dfdd717dc475e591 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Tue, 29 Sep 2020 09:08:20 -0400 Subject: [PATCH] The user directory background tasks are controlled by a separate flag. --- docs/workers.md | 3 +++ synapse/handlers/user_directory.py | 2 +- synapse/server.py | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/workers.md b/docs/workers.md index 87c10f7fd3..3b4c16ecd0 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -318,6 +318,9 @@ the shared configuration would include: run_background_tasks_on: background_worker ``` +You might also wish to investigate the `update_user_directory` and +`media_instance_running_background_jobs` settings. + ### `synapse.app.pusher` Handles sending push notifications to sygnal and email. Doesn't handle any diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py index f803f7e702..79393c8829 100644 --- a/synapse/handlers/user_directory.py +++ b/synapse/handlers/user_directory.py @@ -54,7 +54,7 @@ class UserDirectoryHandler(StateDeltasHandler): # Guard to ensure we only process deltas one at a time self._is_processing = False - if hs.config.run_background_tasks and self.update_user_directory: + if self.update_user_directory: self.notifier.add_replication_callback(self.notify_new_event) # We kick this off so that we don't have to wait for a change before diff --git a/synapse/server.py b/synapse/server.py index bd5a0fb68d..aa2273955c 100644 --- a/synapse/server.py +++ b/synapse/server.py @@ -188,7 +188,6 @@ class HomeServer(metaclass=abc.ABCMeta): REQUIRED_ON_BACKGROUND_TASK_STARTUP = [ "auth", "stats", - "user_directory", ] # This is overridden in derived application classes @@ -255,6 +254,9 @@ class HomeServer(metaclass=abc.ABCMeta): self.datastores = Databases(self.DATASTORE_CLASS, self) logger.info("Finished setting up.") + # Register background tasks required by this server. This must be done + # somewhat manually due to the background tasks not being registered + # unless handlers are instantiated. if self.config.run_background_tasks: self.setup_background_tasks()