mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Add config option to disable media_repo on main synapse
... to stop us doing the cache cleanup jobs on the master.
This commit is contained in:
parent
e1fd4751de
commit
68ca864141
@ -170,6 +170,10 @@ Handles the media repository. It can handle all endpoints starting with::
|
|||||||
|
|
||||||
/_matrix/media/
|
/_matrix/media/
|
||||||
|
|
||||||
|
You should also set ``enable_media_repo: False`` in the shared configuration
|
||||||
|
file to stop the main synapse running background jobs related to managing the
|
||||||
|
media repository.
|
||||||
|
|
||||||
Note this worker cannot be load-balanced: only one instance should be active.
|
Note this worker cannot be load-balanced: only one instance should be active.
|
||||||
|
|
||||||
``synapse.app.client_reader``
|
``synapse.app.client_reader``
|
||||||
@ -203,4 +207,3 @@ the ``worker_main_http_uri`` setting in the frontend_proxy worker configuration
|
|||||||
file. For example::
|
file. For example::
|
||||||
|
|
||||||
worker_main_http_uri: http://127.0.0.1:8008
|
worker_main_http_uri: http://127.0.0.1:8008
|
||||||
|
|
||||||
|
@ -194,14 +194,19 @@ class SynapseHomeServer(HomeServer):
|
|||||||
})
|
})
|
||||||
|
|
||||||
if name in ["media", "federation", "client"]:
|
if name in ["media", "federation", "client"]:
|
||||||
media_repo = self.get_media_repository_resource()
|
if self.get_config().enable_media_repo:
|
||||||
resources.update({
|
media_repo = self.get_media_repository_resource()
|
||||||
MEDIA_PREFIX: media_repo,
|
resources.update({
|
||||||
LEGACY_MEDIA_PREFIX: media_repo,
|
MEDIA_PREFIX: media_repo,
|
||||||
CONTENT_REPO_PREFIX: ContentRepoResource(
|
LEGACY_MEDIA_PREFIX: media_repo,
|
||||||
self, self.config.uploads_path
|
CONTENT_REPO_PREFIX: ContentRepoResource(
|
||||||
),
|
self, self.config.uploads_path
|
||||||
})
|
),
|
||||||
|
})
|
||||||
|
elif name == "media":
|
||||||
|
raise ConfigError(
|
||||||
|
"'media' resource conflicts with enable_media_repo=False",
|
||||||
|
)
|
||||||
|
|
||||||
if name in ["keys", "federation"]:
|
if name in ["keys", "federation"]:
|
||||||
resources.update({
|
resources.update({
|
||||||
|
@ -150,6 +150,13 @@ def start(config_options):
|
|||||||
|
|
||||||
assert config.worker_app == "synapse.app.media_repository"
|
assert config.worker_app == "synapse.app.media_repository"
|
||||||
|
|
||||||
|
if config.enable_media_repo:
|
||||||
|
_base.quit_with_error(
|
||||||
|
"enable_media_repo must be disabled in the main synapse process\n"
|
||||||
|
"before the media repo can be run in a separate worker.\n"
|
||||||
|
"Please add ``enable_media_repo: false`` to the main config\n"
|
||||||
|
)
|
||||||
|
|
||||||
setup_logging(config, use_worker_options=True)
|
setup_logging(config, use_worker_options=True)
|
||||||
|
|
||||||
events.USE_FROZEN_DICTS = config.use_frozen_dicts
|
events.USE_FROZEN_DICTS = config.use_frozen_dicts
|
||||||
|
@ -41,6 +41,12 @@ class ServerConfig(Config):
|
|||||||
# false only if we are updating the user directory in a worker
|
# false only if we are updating the user directory in a worker
|
||||||
self.update_user_directory = config.get("update_user_directory", True)
|
self.update_user_directory = config.get("update_user_directory", True)
|
||||||
|
|
||||||
|
# whether to enable the media repository endpoints. This should be set
|
||||||
|
# to false if the media repository is running as a separate endpoint;
|
||||||
|
# doing so ensures that we will not run cache cleanup jobs on the
|
||||||
|
# master, potentially causing inconsistency.
|
||||||
|
self.enable_media_repo = config.get("enable_media_repo", True)
|
||||||
|
|
||||||
self.filter_timeline_limit = config.get("filter_timeline_limit", -1)
|
self.filter_timeline_limit = config.get("filter_timeline_limit", -1)
|
||||||
|
|
||||||
# Whether we should block invites sent to users on this server
|
# Whether we should block invites sent to users on this server
|
||||||
|
Loading…
Reference in New Issue
Block a user