Skip to content

Commit

Permalink
Test that handling to device messages off master works (#1001)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston authored Jan 7, 2021
1 parent 7a0e6a6 commit 6b1ae9e
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions lib/SyTest/Homeserver/Synapse.pm
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,19 @@ sub start
host => "$bind_host",
port => $self->{ports}{event_persister2},
},
"client_reader" => {
host => "$bind_host",
port => $self->{ports}{client_reader},
},
},

stream_writers => {
events => $self->{redis_host} ne '' ? [ "event_persister1", "event_persister2" ] : "master",

# There's no particular reason to choose client_reader, but I
# couldn't think of a better place and I'm not sure we want to add
# more workers at this point
to_device => $self->{redis_host} ne '' ? [ "client_reader" ] : "master",
},

# We use a high limit so the limit is never reached, but enabling the
Expand Down Expand Up @@ -847,7 +856,7 @@ sub _start_synapse
"worker_listeners" => [
{
type => "http",
resources => [{ names => ["client"] }],
resources => [{ names => ["client", "replication"] }],
port => $self->{ports}{client_reader},
bind_address => $bind_host,
},
Expand Down Expand Up @@ -1189,7 +1198,12 @@ EOCONFIG

sub generate_haproxy_map
{
return <<'EOCONFIG';
my $self = shift;

# The base haproxy routes. Note that we add more routes below if using
# haproxy. Also, the routing for GET requests below takes precedence over
# these routes.
my $haproxy_map = <<'EOCONFIG';
^/_matrix/client/(v2_alpha|r0)/sync$ synchrotron
^/_matrix/client/(api/v1|v2_alpha|r0)/events$ synchrotron
^/_matrix/client/(api/v1|r0)/initialSync$ synchrotron
Expand Down Expand Up @@ -1247,6 +1261,17 @@ sub generate_haproxy_map
^/_matrix/client/(api/v1|r0|unstable)/profile/ event_creator
EOCONFIG

# Some things can only be moved off master when using redis.
if ( $self->{redis_host} ne '' ) {
$haproxy_map .= <<'EOCONFIG';
^/_matrix/client/(api/v1|r0|unstable)/sendToDevice/ client_reader
EOCONFIG
}

return $haproxy_map
}

sub generate_haproxy_get_map
Expand Down

0 comments on commit 6b1ae9e

Please sign in to comment.