From 7e4317b42ae1bdc0a354b71cc8417acb9edb31d3 Mon Sep 17 00:00:00 2001 From: Johanna Dorothea Reichmann Date: Fri, 15 Apr 2022 15:43:56 +0200 Subject: [PATCH] feat(synapse): allow using multiple federation workers --- roles/matrix-synapse/tasks/synapse/workers/init.yml | 2 +- roles/matrix-synapse/tasks/validate_config.yml | 2 +- .../templates/synapse/homeserver.yaml.j2 | 13 ++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/roles/matrix-synapse/tasks/synapse/workers/init.yml b/roles/matrix-synapse/tasks/synapse/workers/init.yml index f59313bde..7e07c445b 100644 --- a/roles/matrix-synapse/tasks/synapse/workers/init.yml +++ b/roles/matrix-synapse/tasks/synapse/workers/init.yml @@ -19,7 +19,7 @@ worker: type: 'federation_sender' instanceId: "{{ item }}" - port: 0 + port: "{{ item }}" metrics_port: "{{ matrix_synapse_workers_federation_sender_workers_metrics_range_start + item }}" register: "matrix_synapse_workers_list_results_federation_sender_workers" loop: "{{ range(0, matrix_synapse_workers_federation_sender_workers_count|int)|list }}" diff --git a/roles/matrix-synapse/tasks/validate_config.yml b/roles/matrix-synapse/tasks/validate_config.yml index 89107c0a6..06abe221d 100644 --- a/roles/matrix-synapse/tasks/validate_config.yml +++ b/roles/matrix-synapse/tasks/validate_config.yml @@ -20,7 +20,7 @@ with_items: - "matrix_synapse_workers_appservice_workers_count" - "matrix_synapse_workers_pusher_workers_count" - - "matrix_synapse_workers_federation_sender_workers_count" +# - "matrix_synapse_workers_federation_sender_workers_count" - name: (Deprecation) Catch and report renamed settings fail: diff --git a/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 b/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 index 97f73c34e..b97c250a7 100644 --- a/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 +++ b/roles/matrix-synapse/templates/synapse/homeserver.yaml.j2 @@ -2859,7 +2859,9 @@ opentracing: # Disables sending of outbound federation transactions on the main process. # Uncomment if using a federation sender worker. # -#send_federation: false +{% if matrix_synapse_workers_federation_sender_workers_count|int > 0 %} +send_federation: false +{% endif %} # It is possible to run multiple federation sender workers, in which case the # work is balanced across them. @@ -2869,8 +2871,13 @@ opentracing: # started, to ensure that all instances are running with the same config (otherwise # events may be dropped). # -#federation_sender_instances: -# - federation_sender1 +{% if matrix_synapse_workers_federation_sender_workers_count != 0%} +federation_sender_instances: +{% for i in range(0, matrix_synapse_workers_federation_sender_workers_count|int)|list %} +# -dd federation_sender1 + - federation_sender:{{ i | int }} +{% endfor %} +{% endif %} # When using workers this should be a map from `worker_name` to the # HTTP replication listener of the worker, if configured.