Skip to content

Faster room joins: Fix bug in awaitPartialStateJoinCompletion #487

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/federation_room_join_partial_state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ func TestPartialStateJoin(t *testing.T) {
) {
t.Helper()

user.MustSyncUntil(t, client.SyncReq{}, client.SyncJoinedTo(user.UserID, room.RoomID))
// Use a `/members` request to wait for the room to be un-partial stated.
// We avoid using `/sync`, as it only waits (or used to wait) for full state at
// particular events, rather than the whole room.
user.MustDoFunc(
t,
"GET",
[]string{"_matrix", "client", "v3", "rooms", room.RoomID, "members"},
)
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we should expose a way for clients to know if the room is partial, rather than trying to infer it? It even sounds like something we might want to expose in the UI?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sounds possibly useful. Though I wonder how much the concept of a partial state room (as opposed to a partial state event) is specific to the synapse implementation.

I suppose there are at least three reasons awaitPartialStateJoinCompletion might be used:

  • to wait for a particular event to have full state
  • to wait for the "current" state of the room to be a full state
  • to wait for all events in the room to have full state (implies the previous 2)

I'd guess that clients and most tests are primarily interested in the 2nd property and it doesn't matter if there's still a partial state event somewhere back in the dag (which synapse doesn't allow, but a theoretical homeserver implementation might).

t.Logf("%s's partial state join to %s completed.", user.UserID, room.RoomID)
}

Expand Down