This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
Presence logic for handling newly joined rooms is very inefficient and does duplicate work #8956
Labels
A-Performance
Performance, both client-facing and admin-facing
A-Presence
O-Occasional
Affects or can be seen by some users regularly or most users rarely
S-Tolerable
Minor significance, cosmetic issues, low or no impact to users.
T-Enhancement
New features, changes in functionality, improvements in performance, or user-facing enhancements.
When a user joins a room Synapse needs to decide what presence updates to send out. For local users joining a room we need to send a presence update to all users in the room, for remote users joining we need to send out all local users presence to the remote user.
This is implemented by streaming the current state delta stream, however when the server joins a federated room for the first time the state delta will include join events for all members. This leads to a situation where we correctly process the fact that a local user has joined a room and send out presence updates, and then incorrectly process each remote join event as if they're a new user join, leading to a lot of unnecessary work and superfluous presence events being generated and sent over federation.
synapse/synapse/handlers/presence.py
Lines 860 to 953 in 6d02eb2
On top of that, we should also only send presence updates when this is the first time a remote server shares a room with the local user.
The text was updated successfully, but these errors were encountered: