diff options
author | Andrej Shadura <andrewsh@debian.org> | 2020-11-19 09:37:58 +0100 |
---|---|---|
committer | Andrej Shadura <andrewsh@debian.org> | 2020-11-19 09:37:58 +0100 |
commit | 7d2fb3b3aa80b8b396c133e43c8b7a736c8b0cc8 (patch) | |
tree | fc5f302434f093a9d5f1fa7cb826ee3b6b567651 /synapse/handlers/room.py | |
parent | bb2febeb6aaa2b7a4150c47b2dc2b318435ccaff (diff) |
New upstream version 1.23.0
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index ec300d88..e7303147 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -771,22 +771,29 @@ class RoomCreationHandler(BaseHandler): ratelimit=False, ) - for invitee in invite_list: + # we avoid dropping the lock between invites, as otherwise joins can + # start coming in and making the createRoom slow. + # + # we also don't need to check the requester's shadow-ban here, as we + # have already done so above (and potentially emptied invite_list). + with (await self.room_member_handler.member_linearizer.queue((room_id,))): content = {} is_direct = config.get("is_direct", None) if is_direct: content["is_direct"] = is_direct - # Note that update_membership with an action of "invite" can raise a - # ShadowBanError, but this was handled above by emptying invite_list. - _, last_stream_id = await self.room_member_handler.update_membership( - requester, - UserID.from_string(invitee), - room_id, - "invite", - ratelimit=False, - content=content, - ) + for invitee in invite_list: + ( + _, + last_stream_id, + ) = await self.room_member_handler.update_membership_locked( + requester, + UserID.from_string(invitee), + room_id, + "invite", + ratelimit=False, + content=content, + ) for invite_3pid in invite_3pid_list: id_server = invite_3pid["id_server"] @@ -1268,7 +1275,7 @@ class RoomShutdownHandler: ) # We now wait for the create room to come back in via replication so - # that we can assume that all the joins/invites have propogated before + # that we can assume that all the joins/invites have propagated before # we try and auto join below. await self._replication.wait_for_stream_position( self.hs.config.worker.events_shard_config.get_instance(new_room_id), |