feat(ui): `RoomListService` re-enables `share_pos`
WIP
The idea is the following: if we keep the sliding sync pos, first off, the homeservers will be happier because they don't have to re-compute a session every time, and second, the overall user experience may be better as we receive much less limited responses from the homeservers.
I don't know why it was creating slowness at some moment. My hope it that the problem has resolved by itself because many refactorings happened since then 🤞.
- Follow up of https://github.com/matrix-org/matrix-rust-sdk/pull/4256
- Address https://github.com/matrix-org/matrix-rust-sdk/issues/3936
Codecov Report
Attention: Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.
Project coverage is 90.15%. Comparing base (
b4146ca) to head (3b2fc00). Report is 87 commits behind head on main.
:white_check_mark: All tests successful. No failed tests found.
Additional details and impacted files
@@ Coverage Diff @@
## main #4741 +/- ##
=======================================
Coverage 90.15% 90.15%
=======================================
Files 334 334
Lines 104717 104730 +13
Branches 104717 104730 +13
=======================================
+ Hits 94408 94420 +12
- Misses 6255 6257 +2
+ Partials 4054 4053 -1
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Might be a bit premature to review without manual testing or some code tests 😇
Do you want me to test on android first?
Might be a bit premature to review without manual testing or some code tests 😇
Do you want me to test on android first?
Yes please, that would be amazing :pray:
@ganfra @pixlwave any news ❤️?
I've linked a rageshake with some issues where the initial loading sometimes takes several seconds and what's more troublesome, some rooms never get a display name: on a first attempt it seemed like the issue was solved after a few seconds, then I restarted the app, saw those rooms with no display name again but this time the name never loaded.
thanks for testing! the display name issue might be https://github.com/matrix-org/matrix-rust-sdk/issues/4051 which becomes more visible, now that we're not getting multiple syncs at start.
Spotted a very slow response from the server, taking around 8 seconds:
2025-03-24T10:25:11.508204Z DEBUG matrix_sdk::sliding_sync: Sending request | crates/matrix-sdk/src/sliding_sync/mod.rs:547 | spans: sync_once{conn_id="room-list" pos="800706/s24077829_1_2604_32014512_8404560_11162949_18873789_46996665_0_2700"} 2025-03-24T10:25:11.508319Z TRACE matrix_sdk::http_client: Serializing request request_type="ruma_client_api::sync::sync_events::v5::Request" | crates/matrix-sdk/src/http_client/mod.rs:109 | spans: sync_once{conn_id="room-list" pos="800706/s24077829_1_2604_32014512_8404560_11162949_18873789_46996665_0_2700"} > send{server_versions=[V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 60s, retry_limit: 3 } request_id="REQ-2"} 2025-03-24T10:25:11.508431Z DEBUG matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: sync_once{conn_id="room-list" pos="800706/s24077829_1_2604_32014512_8404560_11162949_18873789_46996665_0_2700"} > send{server_versions=[V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 60s, retry_limit: 3 } request_id="REQ-2" method=POST uri="https://element.ems.host/_matrix/client/unstable/org.matrix.simplified_msc3575/sync" request_size="651 B"}
And much later:
2025-03-24T10:25:19.549911Z DEBUG matrix_sdk::http_client: Got response | crates/matrix-sdk/src/http_client/mod.rs:220 | spans: sync_once{conn_id="room-list" pos="800706/s24077829_1_2604_32014512_8404560_11162949_18873789_46996665_0_2700"} > send{server_versions=[V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 60s, retry_limit: 3 } request_id="REQ-2" method=POST uri="https://element.ems.host/_matrix/client/unstable/org.matrix.simplified_msc3575/sync" request_size="651 B" status=200 response_size="1.1 kiB"}
It takes 28ms to fully process the response (including i/o access for storing the next pos), so the Rust :crab: SDK is Blazingly :sunglasses: Fast :rocket: .
I'm afraid I can reproduce all 3 reasons why we disabled this in the first place: https://github.com/matrix-org/matrix-rust-sdk/issues/4244#issuecomment-2468415809
Logs for the delayed pagination:
2025-03-24T11:21:45.628899Z INFO elementx: Paginating backwards | TimelineProxy.swift:115 | spans: root
2025-03-24T11:21:48.631601Z DEBUG matrix_sdk::http_client::native: Sending request num_attempt=1 | crates/matrix-sdk/src/http_client/native.rs:55 | spans: root > paginate_backwards{room_id="!qmswaOZGwjTAUbcmtC:sync.boats"} > run_backwards_once{batch_size=20} > messages{room_id="!qmswaOZGwjTAUbcmtC:sync.boats" options=MessagesOptions { dir: Backward, limit: 20 }} > send{server_versions=[V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 30s, retry_limit: 0 } request_id="REQ-51" method=GET uri="https://matrix.sync.boats/_matrix/client/v3/rooms/!qmswaOZGwjTAUbcmtC:sync.boats/messages"}
2025-03-24T11:21:48.746445Z DEBUG matrix_sdk::http_client: Got response | crates/matrix-sdk/src/http_client/mod.rs:220 | spans: root > paginate_backwards{room_id="!qmswaOZGwjTAUbcmtC:sync.boats"} > run_backwards_once{batch_size=20} > messages{room_id="!qmswaOZGwjTAUbcmtC:sync.boats" options=MessagesOptions { dir: Backward, limit: 20 }} > send{server_versions=[V1_1, V1_2, V1_3, V1_4, V1_5, V1_6, V1_7, V1_8, V1_9, V1_10, V1_11] config=RequestConfig { timeout: 30s, retry_limit: 0 } request_id="REQ-51" method=GET uri="https://matrix.sync.boats/_matrix/client/v3/rooms/!qmswaOZGwjTAUbcmtC:sync.boats/messages" status=200 response_size="11.9 kiB"}
Thanks for testing, Doug!
I approve the commits from Ben. I think we can validate this PR and merge it.