Skip to content

Commit 4f61944

Browse files
authored
Make sure we use the right logic for enabling the media repo. (#17424)
This removes the `enable_media_repo` attribute on the server config in favour of always using the `can_load_media_repo` in the media config. This should avoid issues like in #17420 in the future
1 parent ab62aa0 commit 4f61944

File tree

4 files changed

+3
-8
lines changed

4 files changed

+3
-8
lines changed

changelog.d/17424.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make sure we always use the right logic for enabling the media repo.

synapse/app/homeserver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ def _configure_named_resource(
217217
)
218218

219219
if name in ["media", "federation", "client"]:
220-
if self.config.server.enable_media_repo:
220+
if self.config.media.can_load_media_repo:
221221
media_repo = self.get_media_repository_resource()
222222
resources.update(
223223
{

synapse/config/repository.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
126126
# Only enable the media repo if either the media repo is enabled or the
127127
# current worker app is the media repo.
128128
if (
129-
self.root.server.enable_media_repo is False
129+
config.get("enable_media_repo", True) is False
130130
and config.get("worker_app") != "synapse.app.media_repository"
131131
):
132132
self.can_load_media_repo = False

synapse/config/server.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -395,12 +395,6 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
395395
self.presence_router_config,
396396
) = load_module(presence_router_config, ("presence", "presence_router"))
397397

398-
# whether to enable the media repository endpoints. This should be set
399-
# to false if the media repository is running as a separate endpoint;
400-
# doing so ensures that we will not run cache cleanup jobs on the
401-
# master, potentially causing inconsistency.
402-
self.enable_media_repo = config.get("enable_media_repo", True)
403-
404398
# Whether to require authentication to retrieve profile data (avatars,
405399
# display names) of other users through the client API.
406400
self.require_auth_for_profile_requests = config.get(

0 commit comments

Comments
 (0)