synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Draft: prepatory work for batching events to send

Open H-Shay opened this issue 3 years ago • 0 comments

This PR begins work on batching up events during the creation of a room. The PR splits out the creation and sending/persisting of the events. The first three events in the creation of the room-creating the room, joining the creator to the room, and the power levels event are sent sequentially, while the subsequent events are created and collected to be sent at the end of the function. This is currently done by appending them to a list and then iterating over the list to send, the next step (after this PR) would be to send and persist the collected events as a batch.

This change does change the structure of the dag after creating a room, with the events created after the power levels event all referencing that event as their previous event, rather than all the events in room creation sequentially referring to each other. Some of the tests relied on the former ordering, and I have changed them to accommodate the new structure. The tests in DeleteRoomTestCase I believe are failing due to a condition where calling the delete API on a room with the dag in a forked state can result in an orphaned state group, which is then not deleted by the room purge code.

The sytest failure is the result of the test relying on events being returned in a specific order which is no longer guaranteed due to this change. The logged failure shows the correct events being returned, just not in the order that the test expected them to be in.

H-Shay avatar Aug 09 '22 15:08 H-Shay