From 02188147734733f6e1a70bfa4c89bbcb3bfabab8 Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Mon, 11 Jul 2022 15:16:35 +0200 Subject: [PATCH] Stop passing state event IDs during room creation events This actually increases the number of queries executed. --- synapse/handlers/room.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 80a2be25fcb9..497fd6e95e73 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -1011,7 +1011,6 @@ async def _send_events_for_new_room( event_keys = {"room_id": room_id, "sender": creator_id, "state_key": ""} - state_event_ids: List[str] = [] last_sent_event_id: Optional[str] = None def create(etype: str, content: JsonDict, **kwargs: Any) -> JsonDict: @@ -1038,12 +1037,9 @@ async def send(etype: str, content: JsonDict, **kwargs: Any) -> int: ratelimit=False, ignore_shadow_ban=True, prev_event_ids=[last_sent_event_id] if last_sent_event_id else [], - state_event_ids=state_event_ids.copy(), ) last_sent_event_id = sent_event.event_id - if sent_event.is_state(): - state_event_ids.append(sent_event.event_id) return last_stream_id @@ -1069,9 +1065,7 @@ async def send(etype: str, content: JsonDict, **kwargs: Any) -> int: content=creator_join_profile, new_room=True, prev_event_ids=[last_sent_event_id], - state_event_ids=state_event_ids.copy(), ) - state_event_ids.append(member_event_id) last_sent_event_id = member_event_id # We treat the power levels override specially as this needs to be one