Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Performance improvements to marking expired users as inactive #47

Merged
merged 15 commits into from
Jun 19, 2020

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Jun 17, 2020

This is a performance-related improvement to #13, which queried and hid active and already inactive users, one-by-one. This PR updates the code to query only active, expired users, all at once, and then mark them as inactive, all at once.

While writing this PR, I also noticed that we were querying the database using UserIDs in the profiles table. While the column user_id in the profiles table probably should use full, qualified user IDs, in practice in unfortunately uses localparts.

However, the code in #13 looked to have assumed that it contained full user IDs. This PR corrects that, but it is uncertain at this point of how it will interact with existing databases.

Edit: While we do use localparts in a column titled user_id, localparts were correctly extracted both when querying and inserting. This PR just intends to make things clearer.

Best to be reviewed commit-by-commit.

@anoadragon453 anoadragon453 changed the title Performance improvements to marking expired users as inactive, also fix UserID bug Performance improvements to marking expired users as inactive Jun 17, 2020
@anoadragon453 anoadragon453 requested a review from a team June 17, 2020 13:31
@anoadragon453 anoadragon453 force-pushed the anoa/mark_expired_users_active_perf branch from c5f7ad6 to 805aa10 Compare June 17, 2020 15:53
Additionally, have it return UserID objects as the only caller of this
method did this.
@anoadragon453 anoadragon453 force-pushed the anoa/mark_expired_users_active_perf branch from 805aa10 to 27dfc4c Compare June 17, 2020 16:14
anoadragon453 and others added 2 commits June 19, 2020 11:58
@anoadragon453 anoadragon453 requested a review from babolivier June 19, 2020 13:46
anoadragon453 and others added 4 commits June 19, 2020 15:02
Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
INSTR is not available in postgres :(
…ix-org/synapse-dinsic into anoa/mark_expired_users_active_perf

* 'anoa/mark_expired_users_active_perf' of github.com:matrix-org/synapse-dinsic:
  Update tests/utils.py
@anoadragon453 anoadragon453 merged commit 6708163 into dinsic Jun 19, 2020
@anoadragon453 anoadragon453 deleted the anoa/mark_expired_users_active_perf branch June 19, 2020 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants