From ffdf38c3e8fef1a2f804be16ffdbdbf337950c17 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 6 Apr 2020 18:36:32 +0100 Subject: [PATCH] Moar comments --- synapse/replication/tcp/protocol.py | 2 +- synapse/replication/tcp/resource.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/synapse/replication/tcp/protocol.py b/synapse/replication/tcp/protocol.py index eab796634e..9aabb9c586 100644 --- a/synapse/replication/tcp/protocol.py +++ b/synapse/replication/tcp/protocol.py @@ -114,7 +114,7 @@ class BaseReplicationStreamProtocol(LineOnlyReceiver): are only sent by the server. On receiving a new command it calls `on_` with the parsed - command. + command before delegating to `ReplicationCommandHandler.on_`. It also sends `PING` periodically, and correctly times out remote connections (if they send a `PING` command) diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py index 5b0eaf4d2b..b2d6baa2a2 100644 --- a/synapse/replication/tcp/resource.py +++ b/synapse/replication/tcp/resource.py @@ -46,8 +46,14 @@ class ReplicationStreamProtocolFactory(Factory): self.clock = hs.get_clock() self.server_name = hs.config.server_name - # Ensure the replication streamer is started if we register a - # replication server endpoint. + # If we've created a `ReplicationStreamProtocolFactory` then we're + # almost certainly registering a replication listener, so let's ensure + # that we've started a `ReplicationStreamer` instance to actually push + # data. + # + # (This is a bit of a weird place to do this, but the alternatives such + # as putting this in `HomeServer.setup()`, requires either passing the + # listener config again or always starting a `ReplicationStreamer`.) hs.get_replication_streamer() def buildProtocol(self, addr):