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

Add membership event to inital batch of events slated for batch persisting during room creation #14711

Closed
wants to merge 5 commits into from

Conversation

H-Shay
Copy link
Contributor

@H-Shay H-Shay commented Dec 20, 2022

This is a follow-on from #13800 and is part of the work to speed up initial room creation. This PR adds the membership event to the initial batch of events created for batch persisting when a room is created.

Formerly, the code called the update_membership function to create a membership event. This code now does relevant checks and transformations (which I pulled from update_membership) on the creator join profile, etc and then creates the membership event locally and adds it to the batch of events for batch persisting. As a reviewer convince yourself that all the relevant checks and transformations for a join/membership event have been applied in the new path.

@H-Shay H-Shay requested a review from a team as a code owner December 20, 2022 02:16
event, context = await self._rebuild_event_after_third_party_rules(
new_content, event
)
if for_batch:
Copy link
Contributor Author

@H-Shay H-Shay Dec 20, 2022

Choose a reason for hiding this comment

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

I was somewhat unsure what to do here-The code for non-batched events here recalculates the state in case the third party rules sent a state event into the room. I wasn't sure if that was necessary for the batched event, and chose to replace the event using the same prev event ids, state, and auth ids as the batched event that was being replaced, to preserve the batch being persisted in an unbroken chain (ie
creation_event <--- batched_event_1 <----batched_event_2 etc).
My theory is that the next event sent into the room would resolve the state between the two extremities (the state event the third-party rules sent in and the last event in the batched event chain), but if this is not correct or acceptable the other alternative would be to try and fetch the state event that the third party event sent into the room, add it to the state map of the batched event being rebuilt and recalculate the auth events from that, but I think(?) that poses a challenge for the rest of the batched events in the chain who are relying on the batch being an uninterrupted chain.

@erikjohnston erikjohnston self-assigned this Jan 4, 2023
@erikjohnston erikjohnston removed the request for review from a team January 11, 2023 10:45
@erikjohnston erikjohnston removed their assignment Jan 11, 2023
@erikjohnston
Copy link
Member

We're parking this for now, until we have a conclusion about how to handle the third party module problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-blocked (Deprecated Label)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants