diff options
author | Erik Johnston <erik@matrix.org> | 2021-04-23 12:21:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-23 12:21:55 +0100 |
commit | 9d25a0ae65ce8728d0fda1eebaf0b469316f84d7 (patch) | |
tree | fca194d9ae52b9e60eeb4f9d72d1efa9b9b90682 /synapse/replication/tcp/streams | |
parent | Check for space membership during a remote join of a restricted room (#9814) (diff) | |
download | synapse-9d25a0ae65ce8728d0fda1eebaf0b469316f84d7.tar.xz |
Split presence out of master (#9820)
Diffstat (limited to 'synapse/replication/tcp/streams')
-rw-r--r-- | synapse/replication/tcp/streams/_base.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/synapse/replication/tcp/streams/_base.py b/synapse/replication/tcp/streams/_base.py index 9d75a89f1c..b03824925a 100644 --- a/synapse/replication/tcp/streams/_base.py +++ b/synapse/replication/tcp/streams/_base.py @@ -272,15 +272,22 @@ class PresenceStream(Stream): NAME = "presence" ROW_TYPE = PresenceStreamRow - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): store = hs.get_datastore() - if hs.config.worker_app is None: - # on the master, query the presence handler + if hs.get_instance_name() in hs.config.worker.writers.presence: + # on the presence writer, query the presence handler presence_handler = hs.get_presence_handler() - update_function = presence_handler.get_all_presence_updates + + from synapse.handlers.presence import PresenceHandler + + assert isinstance(presence_handler, PresenceHandler) + + update_function = ( + presence_handler.get_all_presence_updates + ) # type: UpdateFunction else: - # Query master process + # Query presence writer process update_function = make_http_update_function(hs, self.NAME) super().__init__( |