Skip to content
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

Improve boot time by implementing sliding sync #2290

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

FadhlanR
Copy link
Contributor

@FadhlanR FadhlanR commented Mar 17, 2025

In this PR, I implemented sliding sync to improve boot time. The latest released version of matrix-js-sdk does not yet support the simplified_msc3575 endpoint, so I had to patch the SDK. The PR to add support for simplified_msc3575 in matrix-js-sdk was merged two days ago, so we can update the SDK version once it is released.

The implementation introduces two sliding sync lists:

  1. One for filtering AI rooms.
  2. One for filtering authentication rooms.

Initially, we only request one timeline event and will load all timeline events when the room is opened. The range for AI rooms increases when a user opens the past session list, and the range for authentication rooms increases when there is an update to the realms state event in account data.

I haven't yet refactored to introduce separate RoomResource and RoomStateResource components, as we discussed, @lukemelia. If needed, we can create a ticket for that.

I've tested this in staging, and it improves the AI panel's loading speed.

Copy link

github-actions bot commented Mar 17, 2025

Host Test Results

    1 files  ±  0      1 suites  ±0   52m 45s ⏱️ + 25m 28s
  845 tests +  1    840 ✅ +  1   5 💤 ±0  0 ❌ ±0 
1 539 runs  +690  1 529 ✅ +685  10 💤 +5  0 ❌ ±0 

Results for commit 6b6f0ea. ± Comparison against base commit 1c5a948.

♻️ This comment has been updated with latest results.

@FadhlanR FadhlanR marked this pull request as ready for review March 20, 2025 05:36
Comment on lines 1699 to 1701
get loadingMoreAIRooms() {
return this.isLoadingMoreAIRooms;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just make the member public. This getter doesn't add anything and the naming is confusing.

Copy link
Contributor Author

@FadhlanR FadhlanR Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the field and getter since We don't want the value of the field can be updated from outside this class.

lists.set(SLIDING_SYNC_AI_ROOM_LIST_NAME, {
ranges: [[0, SLIDING_SYNC_LIST_RANGE_END]],
filters: {
is_dm: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, this is adequate, since we only have AI rooms and Auth rooms, but generally we have been considering a room an AI room if the aibot it one if it's members. Is it possible to use that criteria here?

Copy link
Contributor Author

@FadhlanR FadhlanR Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the filter options are very limited, as you can see here. We could use the room_types filter if we defined the room type during room creation, but we don't.

}

private loadMoreAIRoomsTask = restartableTask(async () => {
if (!this.slidingSync) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a circumstance where this can happen?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated to throw an error

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.

3 participants