You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
While working on #9639 and thinking about how certain aspects of it actually work, I have a feeling that entries destination_rooms are not properly persisted for what it is supposed to do.
However, this store happens before the events are distributed to the individual per_destination transmission loops, which means it is possible for these loops to encounter that the remote is not available, and so destination_rooms will be updated with a stream_id from unsent events.
This would cause the catch-up transmission loop to miss some (or all) events that need to be sent to that destination if the destination is soon retried after the call to store_destination_rooms_entries, with events that were "marked" during that call now not being sent to the destination.
My suggestion would be to move the store_destination_rooms_entries task (or a simpler version of it) to _TransactionQueueManager.__aexit__, where set_destination_last_successful_stream_ordering is already called to set the destinations table (but not destination_rooms), and to do this in a way that it is called once per successful sent batch of events (for all rooms).
This would also maybe require the pending_pdus list to be sorted based on stream_id (and optionally maybe deduplicated, i.e. an "ordered set"), to ensure that only the latest stream_id per room is persisted to the database, and the new store_destination_rooms_entries task need to only update the stream_id, if event.stream_id > database_entry.stream_id.