feat: Support omitting members in the send_join response #977

Open
nex wants to merge 2 commits from nex/feat/provide-fast-joins into main
Owner

This PR allows us to omit membership events in our /send_join endpoint, allowing us to provide fast/partial joins. Joining a room via a continuwuity server with this change should be significantly faster and weigh less on the server itself.

This does not allow us to use fast/partial joins, that is a feature being kinda worked on in nex/feat/fast-joins-hack-do-not-use-DO-NOT-USE (but as the branch name says do not use it)

This PR allows us to omit membership events in our `/send_join` endpoint, allowing us to *provide* fast/partial joins. Joining a room via a continuwuity server with this change should be significantly faster and weigh less on the server itself. This does not allow us to *use* fast/partial joins, that is a feature being kinda worked on in [nex/feat/fast-joins-hack-do-not-use-DO-NOT-USE](https://forgejo.ellis.link/continuwuation/continuwuity/src/branch/nex/feat/fast-joins-hack-do-not-use-DO-NOT-USE) (but as the branch name says *do not use it*)
feat: Support omitting members in the send_join response
All checks were successful
Release Docker Image / define-variables (push) Successful in 4s
Documentation / Build and Deploy Documentation (pull_request) Successful in 43s
Checks / Prek / Pre-commit & Formatting (push) Successful in 1m18s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 5m29s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 12m14s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 11m33s
Release Docker Image / merge (push) Successful in 10s
7f06473a64
fix: Omitting redundant entries from the auth_chain caused problems
All checks were successful
Release Docker Image / define-variables (push) Successful in 11s
Documentation / Build and Deploy Documentation (pull_request) Successful in 42s
Checks / Prek / Pre-commit & Formatting (push) Successful in 1m6s
Checks / Prek / Clippy and Cargo Tests (push) Successful in 5m24s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 12m18s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 12m51s
Release Docker Image / merge (push) Successful in 11s
8bff0179fe
@ -238,6 +258,17 @@ async fn create_join_event(
.rooms
.auth_chain
.event_ids_iter(room_id, starting_events)
// .broad_filter_map(|event_id| async {
Author
Owner

This was commented out as for whatever reason, not including events in the auth chain that are already in the state object caused synapse to explode. Still, without this, this is already a large improvement. Remove commented code before merge?

This was commented out as for whatever reason, not including events in the auth chain that are already in the state object caused synapse to explode. Still, without this, this is already a large improvement. Remove commented code before merge?
@ -257,0 +296,4 @@
.await;
// If there's no servers, just add us
let servers = if servers.is_empty() {
vec![services.globals.server_name().to_string()]
Author
Owner

This should never happen, but also bees shouldn't be able to fly (this did happen in my testing)

This should never happen, but also bees shouldn't be able to fly (this did happen in my testing)
nex changed title from WIP: feat: Support omitting members in the send_join response to feat: Support omitting members in the send_join response 2025-09-05 01:37:01 +00:00
requested review from Owners 2025-09-05 01:37:15 +00:00
@ -211,3 +215,3 @@
drop(mutex_lock);
debug!("Fetching current state IDs");
Author
Owner

should be trace, it contains no valuable timing information or whatever

should be trace, it contains no valuable timing information or whatever
@ -219,9 +223,25 @@ async fn create_join_event(
.collect()
.await;
#[allow(clippy::unnecessary_unwrap)]
Author
Owner

This wrap is in fact necessary otherwise the warning turns into an error

This wrap is in fact necessary otherwise the warning turns into an error
Owner

could use expect to have this comment in the code

could use expect to have this comment in the code
@ -257,0 +286,4 @@
let servers_in_room: Option<Vec<_>> = if !omit_members {
None
} else {
debug!("Fetching list of servers in room");
Author
Owner

Should also be a trace

Should also be a trace
@ -257,0 +302,4 @@
};
Some(servers)
};
debug!("Returning send_join data");
Author
Owner

Another one for trace

Another one for trace
All checks were successful
Release Docker Image / define-variables (push) Successful in 11s
Documentation / Build and Deploy Documentation (pull_request) Successful in 42s
Checks / Prek / Pre-commit & Formatting (push) Successful in 1m6s
Required
Details
Checks / Prek / Clippy and Cargo Tests (push) Successful in 5m24s
Required
Details
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Successful in 12m18s
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Successful in 12m51s
Release Docker Image / merge (push) Successful in 11s
This pull request is blocked because it's outdated.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin nex/feat/provide-fast-joins:nex/feat/provide-fast-joins
git switch nex/feat/provide-fast-joins
Sign in to join this conversation.
No reviewers
continuwuation/Owners
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: continuwuation/continuwuity#977
No description provided.