From 642865770e0f4db027c6c6509f3dd312fe26f5eb Mon Sep 17 00:00:00 2001 From: Jason Little Date: Sat, 1 Jul 2023 21:03:38 -0500 Subject: [PATCH 1/2] Transition worker_replication_* settings to instance_map->main settings --- lib/SyTest/Homeserver/Synapse.pm | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/lib/SyTest/Homeserver/Synapse.pm b/lib/SyTest/Homeserver/Synapse.pm index 06c2e2662..d8fda4ba5 100644 --- a/lib/SyTest/Homeserver/Synapse.pm +++ b/lib/SyTest/Homeserver/Synapse.pm @@ -309,6 +309,10 @@ sub start ) : (), instance_map => { + "main" => { + host => "$bind_host", + port => $self->{ports}{synapse_unsecure}, + }, "event_persister1" => { host => "$bind_host", port => $self->{ports}{event_persister1}, @@ -670,8 +674,6 @@ sub _start_synapse "worker_name" => "pusher", "worker_pid_file" => "$hsdir/pusher.pid", "worker_log_config" => $self->configure_logger("pusher"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -696,8 +698,6 @@ sub _start_synapse "worker_name" => "appservice", "worker_pid_file" => "$hsdir/appservice.pid", "worker_log_config" => $self->configure_logger("appservice"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "manhole", @@ -722,8 +722,6 @@ sub _start_synapse "worker_name" => "federation_sender", "worker_pid_file" => "$hsdir/federation_sender.pid", "worker_log_config" => $self->configure_logger("federation_sender"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "manhole", @@ -748,8 +746,6 @@ sub _start_synapse "worker_name" => "synchrotron", "worker_pid_file" => "$hsdir/synchrotron.pid", "worker_log_config" => $self->configure_logger("synchrotron"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -780,8 +776,6 @@ sub _start_synapse "worker_name" => "federation_reader", "worker_pid_file" => "$hsdir/federation_reader.pid", "worker_log_config" => $self->configure_logger("federation_reader"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -812,8 +806,6 @@ sub _start_synapse "worker_name" => "media_repository", "worker_pid_file" => "$hsdir/media_repository.pid", "worker_log_config" => $self->configure_logger("media_repository"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -844,8 +836,6 @@ sub _start_synapse "worker_name" => "client_reader", "worker_pid_file" => "$hsdir/client_reader.pid", "worker_log_config" => $self->configure_logger("client_reader"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -876,8 +866,6 @@ sub _start_synapse "worker_name" => "user_dir", "worker_pid_file" => "$hsdir/user_dir.pid", "worker_log_config" => $self->configure_logger("user_dir"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -908,8 +896,6 @@ sub _start_synapse "worker_name" => "event_creator", "worker_pid_file" => "$hsdir/event_creator.pid", "worker_log_config" => $self->configure_logger("event_creator"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -940,8 +926,6 @@ sub _start_synapse "worker_name" => "frontend_proxy1", "worker_pid_file" => "$hsdir/frontend_proxy.pid", "worker_log_config" => $self->configure_logger("frontend_proxy"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -972,8 +956,6 @@ sub _start_synapse "worker_name" => "background_worker1", "worker_pid_file" => "$hsdir/background_worker.pid", "worker_log_config" => $self->configure_logger("background_worker"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, }; push @worker_configs, $background_worker_config; @@ -985,8 +967,6 @@ sub _start_synapse "worker_name" => "event_persister1", "worker_pid_file" => "$hsdir/event_persister1.pid", "worker_log_config" => $self->configure_logger("event_persister1"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -1017,8 +997,6 @@ sub _start_synapse "worker_name" => "event_persister2", "worker_pid_file" => "$hsdir/event_persister2.pid", "worker_log_config" => $self->configure_logger("event_persister2"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", @@ -1049,8 +1027,6 @@ sub _start_synapse "worker_name" => "stream_writer", "worker_pid_file" => "$hsdir/stream_writer.pid", "worker_log_config" => $self->configure_logger("stream_writer"), - "worker_replication_host" => "$bind_host", - "worker_replication_http_port" => $self->{ports}{synapse_unsecure}, "worker_listeners" => [ { type => "http", From 583527079f705bb66befb162bfa062e3078beca5 Mon Sep 17 00:00:00 2001 From: Jason Little Date: Sun, 2 Jul 2023 01:29:36 -0500 Subject: [PATCH 2/2] Why is the instance_map shown if there are no workers? --- lib/SyTest/Homeserver/Synapse.pm | 46 +++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/lib/SyTest/Homeserver/Synapse.pm b/lib/SyTest/Homeserver/Synapse.pm index d8fda4ba5..f74d2ce61 100644 --- a/lib/SyTest/Homeserver/Synapse.pm +++ b/lib/SyTest/Homeserver/Synapse.pm @@ -308,28 +308,30 @@ sub start }, ) : (), - instance_map => { - "main" => { - host => "$bind_host", - port => $self->{ports}{synapse_unsecure}, - }, - "event_persister1" => { - host => "$bind_host", - port => $self->{ports}{event_persister1}, - }, - "event_persister2" => { - host => "$bind_host", - port => $self->{ports}{event_persister2}, - }, - "client_reader" => { - host => "$bind_host", - port => $self->{ports}{client_reader}, - }, - "stream_writer" => { - host => "$bind_host", - port => $self->{ports}{stream_writer}, - }, - }, + $self->{workers} ? ( + instance_map => { + "main" => { + host => "$bind_host", + port => $self->{ports}{synapse_unsecure}, + }, + "event_persister1" => { + host => "$bind_host", + port => $self->{ports}{event_persister1}, + }, + "event_persister2" => { + host => "$bind_host", + port => $self->{ports}{event_persister2}, + }, + "client_reader" => { + host => "$bind_host", + port => $self->{ports}{client_reader}, + }, + "stream_writer" => { + host => "$bind_host", + port => $self->{ports}{stream_writer}, + }, + }, + ) : (), stream_writers => { events => $self->{redis_host} ne '' ? [ "event_persister1", "event_persister2" ] : "master",