perf: Optimise account deactivation process #1314
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
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
continuwuation/continuwuity!1314
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "nex/feat/faster-deactivations"
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?
This pull request optimises the user deactivation process by removing all instances of duplicated work, and changes the process to as follows:
This is opposed to the previous flow:
I plan to add a way to honour erase requests and also add a way for admins to force the user to rescind all of their invites and redact all of their messages, but that will require database changes which makes that out of scope for this PR.
Pull request checklist:
mainbranch, and the branch is named something other thanmain.myself, if applicable. This includes ensuring code compiles.
Obviously I'm not willing to test this with a huge account but I gave it a quick burn test on timedout.uk and it's noticeably faster than before.
@ -824,4 +822,1 @@info!("User {sender_user} deactivated their account.");if services.server.config.admin_room_notices {Not sending notices on deactivation to the admin room anymore?
I think I meant to send that notice in
full_user_deactivatebut cut it and forgot to paste it later@ -920,3 +906,2 @@for room_id in all_joined_rooms {let state_lock = services.rooms.state.mutex.lock(room_id).await;// TODO: Rescind all user invitesI assume this isn't done because we can't revoke invites over federation yet
No, it's because we don't have the
useridroomid_eventidcolumn I want, so finding every invite event sent by the sender will require scanning potentially an unbounded number of events in the database to discover them.Adding that column later will also allow me to tackle the server-side component of redact-on ban, implement user redactions, and allow for redact-on-deactivate functionality too. But it's too much for a PR that just improves performance.
@ -974,1 +962,3 @@super::leave_all_rooms(services, user_id).boxed().await;super::update_all_rooms(services, pdu_queue, user_id).await;for room_id in all_joined_rooms {services.rooms.state_cache.forget(room_id, user_id);What does "forget" mean here, exactly?
Makes the homeserver "forget" when the user left the room - https://spec.matrix.org/v1.17/client-server-api/#post_matrixclientv3roomsroomidforget.
Just a cache cleanup operation
9d48d83756c193ca2f0e