-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Experimental Sync Speedup #9798
Experimental Sync Speedup #9798
Conversation
I tested this by applying the changes onto the |
There are some things wrong with this change, which need scrutiny and review;
|
Also, a lot of sytest tests seem to fail because of this change, because sytest expects the behaviour that devicelist changes are still propagated even if you dont share an encrypted room with that user. I can't do much about these tests, since this change directly either invalidates them, or they invalidate this change, so I need some input on this change, and a direction to go forward with. |
If we're only sending devices down for users we share encrypted rooms with we need to ensure that we proactively send down the device list for a user if either a) a room gets upgraded to an encrypted room or b) we join an encrypted room with the user. I'm not sure if that's the case already? |
) -> Set[str]: | ||
"""Returns the set of users who share a room with `user_id`""" | ||
room_ids = await self.get_rooms_for_user( | ||
user_id, on_invalidate=cache_context.invalidate | ||
) | ||
|
||
if encrypted_only: | ||
room_ids = await self._filter_encrypted_rooms(room_ids) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd need to invalidate the cached result if the encryption state of the room change. I think we'd probably want to change _filter_encrypted_rooms
to be a get_encryption_state_for_rooms
and add a cache on that, so that we can on_invalidate=cache_context.invalidate
when we call it, and so it'll "do the right thing".
That's not the case with the current code, but i have both on this checklist. |
I'm going to close this as @ShadowJonathan says he has abandoned it. |
Yeah, I don't think that I'll be working on this any time soon, the PR was more a reference on how-to-do this with some todo points for y'all. |
This PR adds a speedup to
/sync
when the user is in many rooms with many members, the devicelist checking part of these sync requests can take up a while (1 second flat per sync) on single-user homeservers / lower-end setups.This PR makes it so that
/sync
will only check for devicelist changes for users in encrypted rooms, thus this fixes #7524.Pull Request Checklist
EventStore
toEventWorkerStore
.".code blocks
.Signed-off-by: Jonathan de Jong <[email protected]>