Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Optimise room creation event lookups part 2 #13224

4 changes: 2 additions & 2 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ async def create_room(
# Note that do_3pid_invite can raise a ShadowBanError, but this was
# handled above by emptying invite_3pid_list.
(
member_event,
member_event_id,
last_stream_id,
) = await self.hs.get_room_member_handler().do_3pid_invite(
room_id,
Expand All @@ -999,7 +999,7 @@ async def create_room(
prev_event_ids=[last_sent_event_id],
depth=depth,
)
last_sent_event_id = member_event.event_id
last_sent_event_id = member_event_id
depth += 1

result = {"room_id": room_id}
Expand Down
7 changes: 4 additions & 3 deletions synapse/handlers/room_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ async def do_3pid_invite(
id_access_token: Optional[str] = None,
prev_event_ids: Optional[List[str]] = None,
depth: Optional[int] = None,
) -> Tuple[EventBase, int]:
) -> Tuple[str, int]:
"""Invite a 3PID to a room.

Args:
Expand Down Expand Up @@ -1405,7 +1405,7 @@ async def do_3pid_invite(
# We don't check the invite against the spamchecker(s) here (through
# user_may_invite) because we'll do it further down the line anyway (in
# update_membership_locked).
_, stream_id = await self.update_membership(
event_id, stream_id = await self.update_membership(
Comment on lines -1386 to +1408
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh: the mistake was that we didn't have an event to return in this case? Sorry for missing this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nw at all, thanks for the review!

requester, UserID.from_string(invitee), room_id, "invite", txn_id=txn_id
)
else:
Expand Down Expand Up @@ -1436,8 +1436,9 @@ async def do_3pid_invite(
prev_event_ids=prev_event_ids,
depth=depth,
)
event_id = event.event_id

return event, stream_id
return event_id, stream_id

async def _make_and_store_3pid_invite(
self,
Expand Down