perf: Don't attempt to process disconnected rooms #1316
No reviewers
Labels
No labels
Blocked
Bug
Cherry-picking
Database
Dependencies
Dependencies/Renovate
Difficulty
Easy
Difficulty
Hard
Difficulty
Medium
Documentation
Enhancement
Good first issue
Help wanted
Inherited
Matrix/Administration
Matrix/Appservices
Matrix/Auth
Matrix/Client
Matrix/Core
Matrix/E2EE
Matrix/Federation
Matrix/Hydra
Matrix/MSC
Matrix/Media
Matrix/T&S
Meta
Meta/CI
Meta/Packaging
Priority
Blocking
Priority
High
Priority
Low
Security
Status
Confirmed
Status
Duplicate
Status
Invalid
Status
Needs Investigation
Support
To-Merge
Wont fix
old/ci/cd
old/rust
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1316
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nex/perf/dont-process-disconnected-rooms"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Sometimes we'll continue to receive requests and transaction attempts for rooms we aren't in anymore (i.e. have no local users). This PR adds a quick check to several processing points to short circuit if we don't think we're in the given room.
This primarily reduces resource consumption for left-but-not-banned rooms, but also has the side effect that left rooms are far less likely to state reset users back in. Also prevents us serving corrupted state, lol.
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
I have been using this in production since last night and I have not noticed new breakage. I might suggest making the logs trace or something instead of debug_warn
Could probably drop them down to a debug info, but they might actually be important logs that can indicate deeper issues so sticking them lower than debug info is probably too far. Although given the rarity of this during normal operation I think warn is probably fine
Slightly more strongly: the objection was to debug_* anything, if they are key federation breakages they should not be compiled out in release builds
8f35c489a2d248cdc808the changes look good, but it bothers me that we're repeating the same check across fourteen files. maybe in the future we could use axum middleware to share these checks across multiple routes?
Looks like it works as expected in the wild:
those are presumably all profile updates from my recent globalnick change, I know the first one is in a room that state resets frequently and timedout.uk most certainly isn't in anymore, but used to be, and looks to be from my server's POV. As expected, timedout.uk still isn't in that first room, which i think it would've been otherwise.