summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorRichard van der Hoff <richard@matrix.org>2020-02-03 16:19:18 +0000
committerRichard van der Hoff <richard@matrix.org>2020-02-03 16:19:18 +0000
commit4286e429a7359cdeb670fdd63839d0b73836026b (patch)
treeefe770789aba8032e3687afa469966d84aa81978 /synapse
parentmake FederationHandler._check_for_soft_fail async (diff)
downloadsynapse-4286e429a7359cdeb670fdd63839d0b73836026b.tar.xz
make FederationHandler.do_remotely_reject_invite async
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/federation.py13
-rw-r--r--synapse/handlers/room_member.py6
2 files changed, 11 insertions, 8 deletions
diff --git a/synapse/handlers/federation.py b/synapse/handlers/federation.py
index c4a291d1c0..73ef130ace 100644
--- a/synapse/handlers/federation.py
+++ b/synapse/handlers/federation.py
@@ -1531,9 +1531,10 @@ class FederationHandler(BaseHandler):
 
         return event
 
-    @defer.inlineCallbacks
-    def do_remotely_reject_invite(self, target_hosts, room_id, user_id, content):
-        origin, event, room_version = yield self._make_and_verify_event(
+    async def do_remotely_reject_invite(
+        self, target_hosts: Iterable[str], room_id: str, user_id: str, content: JsonDict
+    ) -> EventBase:
+        origin, event, room_version = await self._make_and_verify_event(
             target_hosts, room_id, user_id, "leave", content=content
         )
         # Mark as outlier as we don't have any state for this event; we're not
@@ -1549,10 +1550,10 @@ class FederationHandler(BaseHandler):
         except ValueError:
             pass
 
-        yield self.federation_client.send_leave(target_hosts, event)
+        await self.federation_client.send_leave(target_hosts, event)
 
-        context = yield self.state_handler.compute_event_context(event)
-        yield self.persist_events_and_notify([(event, context)])
+        context = await self.state_handler.compute_event_context(event)
+        await self.persist_events_and_notify([(event, context)])
 
         return event
 
diff --git a/synapse/handlers/room_member.py b/synapse/handlers/room_member.py
index ce8150db6e..4260426369 100644
--- a/synapse/handlers/room_member.py
+++ b/synapse/handlers/room_member.py
@@ -984,8 +984,10 @@ class RoomMemberMasterHandler(RoomMemberHandler):
         """
         fed_handler = self.federation_handler
         try:
-            ret = yield fed_handler.do_remotely_reject_invite(
-                remote_room_hosts, room_id, target.to_string(), content=content,
+            ret = yield defer.ensureDeferred(
+                fed_handler.do_remotely_reject_invite(
+                    remote_room_hosts, room_id, target.to_string(), content=content,
+                )
             )
             return ret
         except Exception as e: