summary refs log tree commit diff
path: root/synapse/module_api
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2021-04-19 10:50:49 +0100
committerGitHub <noreply@github.com>2021-04-19 10:50:49 +0100
commit2b7dd21655b1ed2db490853d2cdbf6fb38704d81 (patch)
treeefc25e330f62856a8d6091cc78be9749e64c0879 /synapse/module_api
parentUser directory: use calculated room membership state instead (#9821) (diff)
downloadsynapse-2b7dd21655b1ed2db490853d2cdbf6fb38704d81.tar.xz
Don't send normal presence updates over federation replication stream (#9828)
Diffstat (limited to 'synapse/module_api')
-rw-r--r--synapse/module_api/__init__.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py
index b7dbbfc27c..a1a2b9aecc 100644
--- a/synapse/module_api/__init__.py
+++ b/synapse/module_api/__init__.py
@@ -50,6 +50,7 @@ class ModuleApi:
         self._auth_handler = auth_handler
         self._server_name = hs.hostname
         self._presence_stream = hs.get_event_sources().sources["presence"]
+        self._state = hs.get_state_handler()
 
         # We expose these as properties below in order to attach a helpful docstring.
         self._http_client = hs.get_simple_http_client()  # type: SimpleHttpClient
@@ -429,11 +430,13 @@ class ModuleApi:
                     UserID.from_string(user), from_key=None, include_offline=False
                 )
 
-                # Send to remote destinations
-                await make_deferred_yieldable(
-                    # We pull the federation sender here as we can only do so on workers
-                    # that support sending presence
-                    self._hs.get_federation_sender().send_presence(presence_events)
+                # Send to remote destinations.
+
+                # We pull out the presence handler here to break a cyclic
+                # dependency between the presence router and module API.
+                presence_handler = self._hs.get_presence_handler()
+                await presence_handler.maybe_send_presence_to_interested_destinations(
+                    presence_events
                 )