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

Commit

Permalink
Have send() update last_sent_stream_id
Browse files Browse the repository at this point in the history
  • Loading branch information
anoadragon453 committed Aug 15, 2022
1 parent 9a6ea3b commit c0dadaa
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions synapse/handlers/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def create(etype: str, content: JsonDict, **kwargs: Any) -> JsonDict:

return e

async def send(etype: str, content: JsonDict, **kwargs: Any) -> int:
async def send(etype: str, content: JsonDict, **kwargs: Any) -> None:
nonlocal last_sent_event_id
nonlocal depth

Expand All @@ -1080,7 +1080,7 @@ async def send(etype: str, content: JsonDict, **kwargs: Any) -> int:
# allow the room creation to complete.
(
sent_event,
last_stream_id,
last_sent_stream_id,
) = await self.event_creation_handler.create_and_send_nonmember_event(
creator,
event,
Expand All @@ -1095,8 +1095,6 @@ async def send(etype: str, content: JsonDict, **kwargs: Any) -> int:
last_sent_event_id = sent_event.event_id
depth += 1

return last_stream_id

try:
room_preset_config = self._presets_dict[room_preset_identifier]
except KeyError:
Expand Down Expand Up @@ -1216,9 +1214,7 @@ async def send(etype: str, content: JsonDict, **kwargs: Any) -> int:

# Send each event in order of its insertion into the dictionary
for (event_type, state_key), content in state_to_send.items():
last_sent_stream_id = await send(
etype=event_type, state_key=state_key, content=content
)
await send(etype=event_type, state_key=state_key, content=content)

return last_sent_stream_id, last_sent_event_id, depth

Expand Down

0 comments on commit c0dadaa

Please sign in to comment.