Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1022,12 +1022,24 @@ async def create_new_client_event(
#
# TODO(faster_joins): figure out how this works, and make sure that the
# old state is complete.
old_state = await self.store.get_events_as_list(state_event_ids)
metadata = await self.store.get_metadata_for_events(state_event_ids)

state_map = {}
Comment thread
erikjohnston marked this conversation as resolved.
Outdated
for state_id in state_event_ids:
data = metadata.get(state_id)
if data is None:
raise Exception("State event not persisted %s", state_id)
Comment thread
erikjohnston marked this conversation as resolved.
Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It would be good to add some more comments, and/or improve the exception message here. What exactly does it mean? Somebody is trying to send an insertion event which refers to a state event which we haven't (yet?) seen? Is there a mechanism to pull said event which has failed, or is this a client-side error?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Have added a comment to try and address those questions, hopefully it makes sense now?

edcd824#diff-3d4a81fcc5b115c649ae67aaba0dd4dd0c5827bb001dfcb90b00ffb1605d518eR1038-R1048


if data.state_key is None:
raise Exception(
"Trying to set non-state event as state: %s", state_id
)
Comment thread
erikjohnston marked this conversation as resolved.

state_map[(data.event_type, data.state_key)] = state_id

context = await self.state.compute_event_context(
event,
state_ids_before_event={
(e.type, e.state_key): e.event_id for e in old_state
},
state_ids_before_event=state_map,
)
else:
context = await self.state.compute_event_context(event)
Expand Down