diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2020-05-15 09:32:13 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-15 09:32:13 -0400 |
commit | e9f3de0baba9be63b77fdaff996274e0abed8ec4 (patch) | |
tree | 910fa828862cf950b8559bb5fd4f68ef51f76e1d /synapse/handlers/room_member_worker.py | |
parent | Implement room version 6 (MSC2240). (#7506) (diff) | |
download | synapse-e9f3de0baba9be63b77fdaff996274e0abed8ec4.tar.xz |
Update the room member handler to use async/await. (#7507)
Diffstat (limited to 'synapse/handlers/room_member_worker.py')
-rw-r--r-- | synapse/handlers/room_member_worker.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/synapse/handlers/room_member_worker.py b/synapse/handlers/room_member_worker.py index 69be86893b..0fc54349ab 100644 --- a/synapse/handlers/room_member_worker.py +++ b/synapse/handlers/room_member_worker.py @@ -15,8 +15,6 @@ import logging -from twisted.internet import defer - from synapse.api.errors import SynapseError from synapse.handlers.room_member import RoomMemberHandler from synapse.replication.http.membership import ( @@ -36,14 +34,13 @@ class RoomMemberWorkerHandler(RoomMemberHandler): self._remote_reject_client = ReplRejectInvite.make_client(hs) self._notify_change_client = ReplJoinedLeft.make_client(hs) - @defer.inlineCallbacks - def _remote_join(self, requester, remote_room_hosts, room_id, user, content): + async def _remote_join(self, requester, remote_room_hosts, room_id, user, content): """Implements RoomMemberHandler._remote_join """ if len(remote_room_hosts) == 0: raise SynapseError(404, "No known servers") - ret = yield self._remote_join_client( + ret = await self._remote_join_client( requester=requester, remote_room_hosts=remote_room_hosts, room_id=room_id, @@ -51,16 +48,16 @@ class RoomMemberWorkerHandler(RoomMemberHandler): content=content, ) - yield self._user_joined_room(user, room_id) + await self._user_joined_room(user, room_id) return ret - def _remote_reject_invite( + async def _remote_reject_invite( self, requester, remote_room_hosts, room_id, target, content ): """Implements RoomMemberHandler._remote_reject_invite """ - return self._remote_reject_client( + return await self._remote_reject_client( requester=requester, remote_room_hosts=remote_room_hosts, room_id=room_id, @@ -68,16 +65,16 @@ class RoomMemberWorkerHandler(RoomMemberHandler): content=content, ) - def _user_joined_room(self, target, room_id): + async def _user_joined_room(self, target, room_id): """Implements RoomMemberHandler._user_joined_room """ - return self._notify_change_client( + return await self._notify_change_client( user_id=target.to_string(), room_id=room_id, change="joined" ) - def _user_left_room(self, target, room_id): + async def _user_left_room(self, target, room_id): """Implements RoomMemberHandler._user_left_room """ - return self._notify_change_client( + return await self._notify_change_client( user_id=target.to_string(), room_id=room_id, change="left" ) |