Skip to content

fix(ui): long-poll room list sync after initial request#6361

Open
TigerInYourDream wants to merge 2 commits intomatrix-org:mainfrom
TigerInYourDream:fix/room-list-long-poll-after-initial-sync
Open

fix(ui): long-poll room list sync after initial request#6361
TigerInYourDream wants to merge 2 commits intomatrix-org:mainfrom
TigerInYourDream:fix/room-list-long-poll-after-initial-sync

Conversation

@TigerInYourDream
Copy link
Copy Markdown

@TigerInYourDream TigerInYourDream commented Mar 27, 2026

Problem

After the initial room-list sync, RoomListService continues sending timeout=0 requests because SettingUp, Recovering, and Running (before fully loaded) all forced immediate responses. This creates a tight polling loop when idle — the server returns empty responses instantly, and the client re-sends the same pos right away.

Fix

Only force timeout=0 for State::Init. All post-init states use PollTimeout::Default, letting the server long-poll when idle. If the server has pending changes, it can still respond immediately regardless of the timeout value.

Test

Added a regression test verifying the second sync request carries timeout=30000 instead of timeout=0.

  • Public API changes documented in changelogs (optional)

@TigerInYourDream TigerInYourDream requested a review from a team as a code owner March 27, 2026 08:44
@TigerInYourDream TigerInYourDream requested review from stefanceriu and removed request for a team March 27, 2026 08:44
@TigerInYourDream
Copy link
Copy Markdown
Author

TigerInYourDream commented Mar 27, 2026

Reproduction context

  • Local homeserver implementing MSC4186
  • Robrix as the client, with matrix-sdk-ui driving the room-list sync

Observed symptom

After the initial sync completed and the client was idle, the homeserver kept receiving a continuous stream of requests like:

/_matrix/client/unstable/org.matrix.simplified_msc3575/sync?pos=539&timeout=0

with the same pos repeating. The loop is driven by the room-list timeout policy: all post-init states were forcing timeout=0, so the server had no choice but to respond immediately, and the client would re-send right away.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 27, 2026

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing TigerInYourDream:fix/room-list-long-poll-after-initial-sync (c47fa7e) with main (c708ed1)

Open in CodSpeed

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 97.22222% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.77%. Comparing base (d64c990) to head (c47fa7e).
⚠️ Report is 699 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/matrix-sdk-ui/src/room_list_service/mod.rs 97.22% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6361      +/-   ##
==========================================
+ Coverage   88.93%   89.77%   +0.83%     
==========================================
  Files         357      357              
  Lines       99195    98818     -377     
  Branches    99195    98818     -377     
==========================================
+ Hits        88221    88713     +492     
+ Misses       6991     6620     -371     
+ Partials     3983     3485     -498     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant