Merge pull request #6837 from matrix-org/rav/federation_async

Port much of `synapse.handlers.federation` to async/await.
This commit is contained in:
Richard van der Hoff 2020-02-04 12:06:18 +00:00 committed by GitHub
commit c7d6d5c69e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 212 additions and 235 deletions

1
changelog.d/6837.misc Normal file
View File

@ -0,0 +1 @@
Port much of `synapse.handlers.federation` to async/await.

File diff suppressed because it is too large Load Diff

View File

@ -932,10 +932,9 @@ class EventCreationHandler(object):
# way? If we have been invited by a remote server, we need # way? If we have been invited by a remote server, we need
# to get them to sign the event. # to get them to sign the event.
returned_invite = yield federation_handler.send_invite( returned_invite = yield defer.ensureDeferred(
invitee.domain, event federation_handler.send_invite(invitee.domain, event)
) )
event.unsigned.pop("room_state", None) event.unsigned.pop("room_state", None)
# TODO: Make sure the signatures actually are correct. # TODO: Make sure the signatures actually are correct.

View File

@ -944,9 +944,11 @@ class RoomMemberMasterHandler(RoomMemberHandler):
# join dance for now, since we're kinda implicitly checking # join dance for now, since we're kinda implicitly checking
# that we are allowed to join when we decide whether or not we # that we are allowed to join when we decide whether or not we
# need to do the invite/join dance. # need to do the invite/join dance.
yield self.federation_handler.do_invite_join( yield defer.ensureDeferred(
self.federation_handler.do_invite_join(
remote_room_hosts, room_id, user.to_string(), content remote_room_hosts, room_id, user.to_string(), content
) )
)
yield self._user_joined_room(user, room_id) yield self._user_joined_room(user, room_id)
# Check the room we just joined wasn't too large, if we didn't fetch the # Check the room we just joined wasn't too large, if we didn't fetch the
@ -982,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