mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-12-02 02:09:35 +00:00
matrix-synapse: keep the main process media-capable without a quarantined_media_changes writer
Without a `quarantined_media_changes` stream writer worker, the main process is the writer for that stream and the reverse-proxy companion routes the quarantine admin APIs to it. When media repository workers were enabled, the main process had `enable_media_repo: false`, so it did not register those APIs and returned 404. Keep `enable_media_repo` enabled on the main process in that case. The media repository's main background jobs remain assigned to the first media repository worker via `media_instance_running_background_jobs`. Since `homeserver.yaml` is shared with all workers, the other workers' configuration files disable `enable_media_repo` again, so they don't load the media repository (and run its retention tasks) needlessly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
adff066f23
commit
dff6d37cfb
@@ -1289,8 +1289,23 @@ matrix_synapse_workers_media_repository_workers_container_arguments: []
|
||||
|
||||
# matrix_synapse_enable_media_repo controls if the main Synapse process should serve media repository endpoints or if it should be left to media_repository workers (see `matrix_synapse_workers_media_repository_workers_count`).
|
||||
# This is enabled if workers are disabled, or if they are enabled, but there are no media repository workers.
|
||||
# It's also enabled if there are no `quarantined_media_changes` stream writer workers.
|
||||
# The main process then remains the writer for that stream, and Synapse requires the writer to be media-capable in order to serve the quarantine admin APIs.
|
||||
# This does not make the main process run the media repository's main background jobs, as those are assigned via `matrix_synapse_media_instance_running_background_jobs`.
|
||||
# Since `homeserver.yaml` is shared with workers, worker configuration files disable it again for the other workers in this case (see `worker.yaml.j2`).
|
||||
# Adjusting this value manually is generally not necessary.
|
||||
matrix_synapse_enable_media_repo: "{{ not matrix_synapse_ext_media_repo_enabled and (not matrix_synapse_workers_enabled or (matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list | length == 0)) }}"
|
||||
matrix_synapse_enable_media_repo: |-
|
||||
{{
|
||||
not matrix_synapse_ext_media_repo_enabled
|
||||
and
|
||||
(
|
||||
not matrix_synapse_workers_enabled
|
||||
or
|
||||
(matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list | length == 0)
|
||||
or
|
||||
(matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'stream_writer') | selectattr('stream_writer_stream', 'equalto', 'quarantined_media_changes') | list | length == 0)
|
||||
)
|
||||
}}
|
||||
|
||||
# matrix_synapse_enable_local_media_storage controls whether the local on-disk media storage provider is enabled in Synapse.
|
||||
# When disabled, media is stored only in configured `media_storage_providers` and temporary files are used for processing (no local caching).
|
||||
|
||||
@@ -20,6 +20,13 @@ worker_log_config: /data/{{ matrix_server_fqn_matrix }}.log.config
|
||||
) %}
|
||||
{% if is_media_capable_quarantined_media_changes_stream_writer %}
|
||||
enable_media_repo: true
|
||||
{% elif matrix_synapse_worker_details.type != 'media_repository' and matrix_synapse_enable_media_repo | bool and matrix_synapse_workers_enabled_list | selectattr('type', 'equalto', 'media_repository') | list | length > 0 %}
|
||||
{#
|
||||
`enable_media_repo` is only enabled in `homeserver.yaml` despite there being media repository workers
|
||||
so that the main process can serve the quarantine admin APIs (see `matrix_synapse_enable_media_repo`).
|
||||
Other workers (besides media repository workers) should not load the media repository (and run its background tasks), so we disable it for them.
|
||||
#}
|
||||
enable_media_repo: false
|
||||
{% endif %}
|
||||
|
||||
{% set http_resources = [] %}
|
||||
|
||||
Reference in New Issue
Block a user