mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-25 11:05:49 +03:00
8bcfc2eaad
This PR attempts to eliminate unnecessary presence sending work when your local server joins a room, or when a remote server joins a room your server is participating in by processing state deltas in chunks rather than individually. --- When your server joins a room for the first time, it requests the historical state as well. This chunk of new state is passed to the presence handler which, after filtering that state down to only membership joins, will send presence updates to homeservers for each join processed. It turns out that we were being a bit naive and processing each event individually, and sending out presence updates for every one of those joins. Even if many different joins were users on the same server (hello IRC bridges), we'd send presence to that same homeserver for every remote user join we saw. This PR attempts to deduplicate all of that by processing the entire batch of state deltas at once, instead of only doing each join individually. We process the joins and note down which servers need which presence: * If it was a local user join, send that user's latest presence to all servers in the room * If it was a remote user join, send the presence for all local users in the room to that homeserver We deduplicate by inserting all of those pending updates into a dictionary of the form: ``` { server_name1: {presence_update1, ...}, server_name2: {presence_update1, presence_update2, ...} } ``` Only after building this dict do we then start sending out presence updates. |
||
---|---|---|
.. | ||
.gitignore | ||
9003.misc | ||
9123.misc | ||
9150.feature | ||
9203.feature | ||
9240.misc | ||
9257.bugfix | ||
9281.doc | ||
9291.doc | ||
9296.bugfix | ||
9299.misc | ||
9300.feature | ||
9301.feature | ||
9305.misc | ||
9307.misc | ||
9308.doc | ||
9311.feature | ||
9317.doc | ||
9321.bugfix | ||
9322.doc | ||
9326.misc | ||
9333.bugfix | ||
9361.bugfix | ||
9362.misc | ||
9376.feature | ||
9377.misc | ||
9381.misc | ||
9383.feature | ||
9384.misc | ||
9390.doc | ||
9391.bugfix | ||
9393.bugfix | ||
9394.misc | ||
9395.bugfix | ||
9396.misc | ||
9400.feature | ||
9402.bugfix | ||
9404.doc | ||
9407.doc | ||
9408.misc | ||
9421.bugfix | ||
9425.bugfix | ||
9426.bugfix | ||
9428.bugfix | ||
9429.removal | ||
9433.docker | ||
9434.doc |