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

Skip room join until we run into a 403/401 #50

Closed
MadLittleMods opened this issue Aug 29, 2022 · 1 comment · May be fixed by #272
Closed

Skip room join until we run into a 403/401 #50

MadLittleMods opened this issue Aug 29, 2022 · 1 comment · May be fixed by #272
Labels
A-archive-room-view The view to look at a room day by day in the archive A-backend Related to the backend Node.js server pieces T-Enhancement New feature or request

Comments

@MadLittleMods
Copy link
Contributor

Spawned from #31 (comment)


Most of the time, we're already joined to the room so there is no need to try joining the room every single time a request is made.

We can instead skip the join and go straight into fetching the room metadata. If we encounter a403 Forbidden or 401 Unauthorized, we can then run the join and run the data fetchers again.

@MadLittleMods MadLittleMods added the T-Enhancement New feature or request label Aug 29, 2022
@MadLittleMods MadLittleMods added the A-archive-room-view The view to look at a room day by day in the archive label Oct 20, 2022
@MadLittleMods
Copy link
Contributor Author

MadLittleMods commented Oct 25, 2022

Exploring this while addressing #107 because we need to get the roomId for a room alias to use with the various Matrix API's and /join/{roomIdOrAlias} -> { room_id } is a great way to get it. It also solves the federation problem for rooms the server doesn't already know about

The only alternative is to use GET /_matrix/client/r0/directory/room/{roomAlias} -> { room_id, servers }.

Time-wise, the two endpoints aren't too different and /join may even be slower. But complexity-wise, it's nice to always go down the same code-path regardless. If anything, we can improve the subsequent join time in Synapse.

Comparison timing
POST /_matrix/client/v3/join/{roomIdOrAlias} 
1289ms
277ms
435ms
715ms
476ms
320ms
619ms
374ms
684ms
419ms
400ms
270ms
GET /_matrix/client/r0/directory/room/%23matrix%3Amatrix.org
240ms
578ms
314ms
237ms
241ms
243ms
242ms
251ms
387ms
232ms
238ms
250ms

I guess we will close this for now since getting the room ID from /join seems best.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-archive-room-view The view to look at a room day by day in the archive A-backend Related to the backend Node.js server pieces T-Enhancement New feature or request
Projects
None yet
1 participant