diff options
author | Erik Johnston <erikj@jki.re> | 2019-02-27 15:46:26 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-27 15:46:26 +0000 |
commit | 8267034a63e0d7e33b2a10c1a0660991b448baee (patch) | |
tree | b9cdd345d268191f5a1043acd9f65666cce71fd3 | |
parent | Merge pull request #4757 from matrix-org/erikj/key_api_fed_readae (diff) | |
parent | Newsfile (diff) | |
download | synapse-8267034a63e0d7e33b2a10c1a0660991b448baee.tar.xz |
Merge pull request #4758 from matrix-org/erikj/use_presence_replication
When presence is disabled don't send over replication
-rw-r--r-- | changelog.d/4757.misc | 1 | ||||
-rw-r--r-- | synapse/federation/federation_server.py | 3 | ||||
-rw-r--r-- | synapse/replication/slave/storage/presence.py | 7 |
3 files changed, 9 insertions, 2 deletions
diff --git a/changelog.d/4757.misc b/changelog.d/4757.misc new file mode 100644 index 0000000000..42bb66f7aa --- /dev/null +++ b/changelog.d/4757.misc @@ -0,0 +1 @@ +When presence is disabled don't send over replication. diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py index 569eb277a9..81f3b4b1ff 100644 --- a/synapse/federation/federation_server.py +++ b/synapse/federation/federation_server.py @@ -886,6 +886,9 @@ class ReplicationFederationHandlerRegistry(FederationHandlerRegistry): def on_edu(self, edu_type, origin, content): """Overrides FederationHandlerRegistry """ + if not self.config.use_presence and edu_type == "m.presence": + return + handler = self.edu_handlers.get(edu_type) if handler: return super(ReplicationFederationHandlerRegistry, self).on_edu( diff --git a/synapse/replication/slave/storage/presence.py b/synapse/replication/slave/storage/presence.py index 92447b00d4..9e530defe0 100644 --- a/synapse/replication/slave/storage/presence.py +++ b/synapse/replication/slave/storage/presence.py @@ -54,8 +54,11 @@ class SlavedPresenceStore(BaseSlavedStore): def stream_positions(self): result = super(SlavedPresenceStore, self).stream_positions() - position = self._presence_id_gen.get_current_token() - result["presence"] = position + + if self.hs.config.use_presence: + position = self._presence_id_gen.get_current_token() + result["presence"] = position + return result def process_replication_rows(self, stream_name, token, rows): |