summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorKateřina Churanová <katerina.churanova@gmail.com>2022-09-28 14:31:53 +0200
committerGitHub <noreply@github.com>2022-09-28 12:31:53 +0000
commit6caa3030835f879724c003a5b0dc66a6285451d8 (patch)
tree9e33ccb6e4e086c19e211bd8dc7ab21a52f41496 /synapse/handlers
parentAdd instruction for running unit tests in parallel (#13928) (diff)
downloadsynapse-6caa3030835f879724c003a5b0dc66a6285451d8.tar.xz
fix: Push notifications for invite over federation (#13719)
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/federation.py13
-rw-r--r--synapse/handlers/federation_event.py1
2 files changed, 11 insertions, 3 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index 74580f60df..8f847ff845 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -149,6 +149,7 @@ class FederationHandler:
         self.http_client = hs.get_proxied_blacklisted_http_client()
         self._replication = hs.get_replication_data_handler()
         self._federation_event_handler = hs.get_federation_event_handler()
+        self._bulk_push_rule_evaluator = hs.get_bulk_push_rule_evaluator()
 
         self._clean_room_for_join_client = ReplicationCleanRoomRestServlet.make_client(
             hs
@@ -956,9 +957,15 @@ class FederationHandler:
         )
 
         context = EventContext.for_outlier(self._storage_controllers)
-        await self._federation_event_handler.persist_events_and_notify(
-            event.room_id, [(event, context)]
-        )
+
+        await self._bulk_push_rule_evaluator.action_for_event_by_user(event, context)
+        try:
+            await self._federation_event_handler.persist_events_and_notify(
+                event.room_id, [(event, context)]
+            )
+        except Exception:
+            await self.store.remove_push_actions_from_staging(event.event_id)
+            raise
 
         return event
 
diff --git a/synapse/handlers/federation_event.py b/synapse/handlers/federation_event.py
index 2d7cde7506..3fac256881 100644
--- a/synapse/handlers/federation_event.py
+++ b/synapse/handlers/federation_event.py
@@ -2170,6 +2170,7 @@ class FederationEventHandler:
         if instance != self._instance_name:
             # Limit the number of events sent over replication. We choose 200
             # here as that is what we default to in `max_request_body_size(..)`
+            result = {}
             try:
                 for batch in batch_iter(event_and_contexts, 200):
                     result = await self._send_events(