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
Conversation
erikjohnston
commented
Mar 29, 2023
| "check_too_many_devices_for_user_last_seen", | ||
| None, | ||
| sql, | ||
| user_id, |
Member
Author
There was a problem hiding this comment.
The problem here is that execute takes a *args, unlike txn.execute that takes a tuple
erikjohnston
commented
Mar 29, 2023
|
|
||
| # Fetch the devices to delete. | ||
| sql = """ | ||
| SELECT DISTINCT device_id FROM devices |
Member
Author
There was a problem hiding this comment.
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.
erikjohnston
commented
Mar 29, 2023
| user_id = ? | ||
| AND NOT hidden | ||
| AND last_seen < ? | ||
| AND last_seen <= ? |
Member
Author
There was a problem hiding this comment.
This was just to make the numbers in the tests be correct
MatMaul
approved these changes
Mar 29, 2023
erikjohnston
added a commit
that referenced
this pull request
Mar 31, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes up #15183
(I forgot to write tests in turns out...)