mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 02:53:51 +01:00
make FederationHandler.do_remotely_reject_invite async
This commit is contained in:
parent
c3f296af32
commit
4286e429a7
2 changed files with 11 additions and 8 deletions
|
@ -1531,9 +1531,10 @@ class FederationHandler(BaseHandler):
|
||||||
|
|
||||||
return event
|
return event
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
async def do_remotely_reject_invite(
|
||||||
def do_remotely_reject_invite(self, target_hosts, room_id, user_id, content):
|
self, target_hosts: Iterable[str], room_id: str, user_id: str, content: JsonDict
|
||||||
origin, event, room_version = yield self._make_and_verify_event(
|
) -> EventBase:
|
||||||
|
origin, event, room_version = await self._make_and_verify_event(
|
||||||
target_hosts, room_id, user_id, "leave", content=content
|
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
|
# 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:
|
except ValueError:
|
||||||
pass
|
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)
|
context = await self.state_handler.compute_event_context(event)
|
||||||
yield self.persist_events_and_notify([(event, context)])
|
await self.persist_events_and_notify([(event, context)])
|
||||||
|
|
||||||
return event
|
return event
|
||||||
|
|
||||||
|
|
|
@ -984,9 +984,11 @@ class RoomMemberMasterHandler(RoomMemberHandler):
|
||||||
"""
|
"""
|
||||||
fed_handler = self.federation_handler
|
fed_handler = self.federation_handler
|
||||||
try:
|
try:
|
||||||
ret = yield fed_handler.do_remotely_reject_invite(
|
ret = yield defer.ensureDeferred(
|
||||||
|
fed_handler.do_remotely_reject_invite(
|
||||||
remote_room_hosts, room_id, target.to_string(), content=content,
|
remote_room_hosts, room_id, target.to_string(), content=content,
|
||||||
)
|
)
|
||||||
|
)
|
||||||
return ret
|
return ret
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# if we were unable to reject the exception, just mark
|
# if we were unable to reject the exception, just mark
|
||||||
|
|
Loading…
Reference in a new issue