mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 12:36:02 -04:00
Optimise createRoom with multiple invites (#8559)
By not dropping the membership lock between invites, we can stop joins from grabbing the lock when we're half-done and slowing the whole thing down.
This commit is contained in:
parent
00b24aa545
commit
56f0ee78a9
3 changed files with 25 additions and 13 deletions
|
@ -307,7 +307,7 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
|
|||
key = (room_id,)
|
||||
|
||||
with (await self.member_linearizer.queue(key)):
|
||||
result = await self._update_membership(
|
||||
result = await self.update_membership_locked(
|
||||
requester,
|
||||
target,
|
||||
room_id,
|
||||
|
@ -322,7 +322,7 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
|
|||
|
||||
return result
|
||||
|
||||
async def _update_membership(
|
||||
async def update_membership_locked(
|
||||
self,
|
||||
requester: Requester,
|
||||
target: UserID,
|
||||
|
@ -335,6 +335,10 @@ class RoomMemberHandler(metaclass=abc.ABCMeta):
|
|||
content: Optional[dict] = None,
|
||||
require_consent: bool = True,
|
||||
) -> Tuple[str, int]:
|
||||
"""Helper for update_membership.
|
||||
|
||||
Assumes that the membership linearizer is already held for the room.
|
||||
"""
|
||||
content_specified = bool(content)
|
||||
if content is None:
|
||||
content = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue