-
-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix not showing display names in already synced rooms #171
Conversation
If you want a moderately large room to test with, (joining the latter room might induce a lot of load on your homeserver, so might be a good idea to do that on |
So I tested out this branch, and it does seem to fix the displayname bug, but it has a pretty significant perf impact. I ran a test opening the client to 2f51e96 (current head of 8943909 (current head of The I haven't tested with My only real idea for improving this would be to fetch member details on-demand for each member, rather than all at once when the room is loaded. Unfortunately, this sounds much more complicated to implement, and likely prone to reintroducing the bug again in the future. A second possibility would be to run the It might be worth talking with some of the |
I think that @Benjamin-L is right that the way to do this in order to avoid having to fetch the display names for all users in the room, and do it per-user, similar to how rooms signal while rendering visible content that they need more messages loaded:
This does mean that user IDs might be displayed for a second or two when scroling back and seeing messages from users whose information hasn't been fetched, but it should be much lighter on the CPU and network. |
Changing it to load it in worker/background. @Benjamin-L thank you so much for perf-testing this. The current implementation is indeed unacceptably locking the UI. @ulyssa I am not sure if we should only load displaynames for users that have messages currently in scrollback. Because then we get the "ID flashing before displayname" for any new incoming messages of a user that doesn't have some message in the recent scrollback. I would rather load I also think we could use |
Also perhaps |
thanks :) If you push the background-loading code I should be able to run another test later today.
We could probably avoid that problem for incoming messages by blocking the message event handlers on a call to
I don't think that will work, since messages will stick around after a member leaves the room. |
I have to do it properly, I just piggy-backed on the loading older messages thread. It does kinda work but it later re-fetches the members unnecessarily. I'll give it its own
I would be very hesitant to block in the message event handler. Your solution of waking-up sounds much better, thanks!
Ah, of course. |
3959cb5
to
b652823
Compare
Fixes ulyssa#149 The display_names were only populated from the OriginalSyncRoomMemberEvent. When opening an already synced room, display_names is not populated. The ChatStore's `need_load` is changed to a hashmap with OwnedRoomIds as keys and a bitmask of "needs" as value. The "need" thus can be `MESSAGES` or `MEMBERS`. The task that loads messages now also loads members, if that flag is set for the room, which is done when opening a window. Thanks to <[email protected]> for finding the source of the bug in that issue.
b652823
to
e71e02e
Compare
@Benjamin-L this now has background-loading. If I understand correctly, this would play very nicely with your |
Ran a test with the new code (e71e02e). This is pretty much what we would expect: it takes a few seconds before the displaynames pop in, and we still have the cpu spike, but the UI remains responsive the whole time. After the room was loaded for the first time, I didn't see any additional cpu spikes. |
Thank you so much for fixing this @benjajaja , and thank you for testing its performance, @Benjamin-L ! |
Fixes #149
The display_names only got populated from the
OriginalSyncRoomMemberEvent. When opening an already synced room, display_names is not populated.
ClientWorker::get_room extends the returned FetchedRoom to include RoomMembers from Room::members_no_sync. This allows RoomState::new to populate the RoomInfo's display_names.
Thanks to @Benjamin-L for finding the source of the bug in that issue. It was mentioned that it might be problematic to iterate over all members of large rooms. The largest room I had available to test this was only about 200 members, but it seemed fine.