-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Not all presence updates should be sent out over federation immediately. #9415
Comments
We could also do this based on whether a user shares a private room with another user. Send out presence updates to users you share a private room with immediately, and wait until the next transaction for those users you only share a public room with. |
According to: synapse/synapse/handlers/presence.py Lines 1270 to 1273 in 473dfec
(which seems to be the central place fed pings that are purely presence are sent from, as far as I've crawled through the various code paths), it looks like we only let presence updates trigger immediate fed pings once every |
Ah right. That's making sure that we don't send out presence updates too often, but this issue is saying that even when we do send out presence updates we shouldn't necessarily immediately send a transaction and instead we can wait a short period to see if any other updates come in that need to be sent to the remote server. That way we can often batch up presence updates with other updates to reduce the number of transactions sent |
Ah right, that makes sense indeed, thanks for clarifying 👍 |
Could I get some clarifying details on what you would like here? I'm looking at presence states of:
|
For me a delay of 30s would be enough. Currently I sometimes have 2 clients fighting over presence changes and generating a lot of EDUs in rapid fashing, while some smoothing would be nice. Possibly synapse should just track presence per device and then send the "highest" presence, i.e. busy > online > unavailable > offline. |
That's interesting. There is already an anti-flicker mechanism coded in, I believe. I went and took a peek to find it, it seems to only be used on worker deployments(but I may have missed it for monolith in my haste). Is that what you have? I feel like I read something about this in an issue somewhere |
No, I can reproduce this on a worker setup. But I haven't tried it in the last 2 months or so, since it causes a lot of CPU use on my server. |
I found the original issue I saw this in, it was closed after a bunch of work was done to largely make the situation better(but apparently this segment wasn't addressed). I will add this to my to-do list to investigate. Perhaps open a new issue with the details you provided, as many details as you can. I'll see what I can do |
Similarly to #8955, not all presence updates are urgent and are safe to delay for a short time (e.g. online to idle transitions which are done based on fairly arbitrary timers). By not immediately sending out these updates it allows Synapse to potentially batch up these presence updates with other data that needs to be sent, reducing the number of overall transactions sent.
The text was updated successfully, but these errors were encountered: