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

Fix registering a device on an account with lots of devices#15348

Merged
erikjohnston merged 2 commits into
developfrom
erikj/fixup_pruning
Mar 29, 2023
Merged

Fix registering a device on an account with lots of devices#15348
erikjohnston merged 2 commits into
developfrom
erikj/fixup_pruning

Conversation

@erikjohnston
Copy link
Copy Markdown
Member

Fixes up #15183

(I forgot to write tests in turns out...)

@erikjohnston erikjohnston marked this pull request as ready for review March 29, 2023 13:03
@erikjohnston erikjohnston requested a review from a team as a code owner March 29, 2023 13:03
"check_too_many_devices_for_user_last_seen",
None,
sql,
user_id,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The problem here is that execute takes a *args, unlike txn.execute that takes a tuple


# Fetch the devices to delete.
sql = """
SELECT DISTINCT device_id FROM devices
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You can't do a DISTINCT ... ORDER BY last_seen if last_seen doesn't appear in the distinct.

The distinct isn't necessary, as there are unique indexes.

user_id = ?
AND NOT hidden
AND last_seen < ?
AND last_seen <= ?
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This was just to make the numbers in the tests be correct

@erikjohnston erikjohnston enabled auto-merge (squash) March 29, 2023 13:15
@erikjohnston erikjohnston merged commit f0d8f66 into develop Mar 29, 2023
@erikjohnston erikjohnston deleted the erikj/fixup_pruning branch March 29, 2023 13:37
erikjohnston added a commit that referenced this pull request Mar 31, 2023
* Revert "Fix registering a device on an account with lots of devices (#15348)"

This reverts commit f0d8f66.

* Revert "Delete stale non-e2e devices for users, take 3 (#15183)"

This reverts commit 78cdb72.
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.

2 participants