-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: resolve intermittent Tokenserver test failure #1171
Conversation
This is still not working...converting to a draft |
Whew. The problem was that users were sometimes being created with the same timestamp, which caused a problem here: since the two most recently created users share the same timestamp, neither of those users were being replaced, resulting in two "active" user records for a given email address. |
oh, huh. |
@@ -162,20 +162,32 @@ def test_cleanup_of_old_records(self): | |||
# Do a sleep halfway through so we can test use of grace period. | |||
email1 = '[email protected]' | |||
user1 = self.database.allocate_user(email1) | |||
# We have to sleep between every user create/update operation: if two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do wonder if this might eventually bite us (e.g. if the client is also in rust and is on a particularly close node, they may respond faster than one ms.) We might want to add an issue to check for active user records before writing a second and returning a 409 CONFLICT if one is detected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that the risk of this happening on the new Tokenserver is any greater than the risk of it happening on the old Tokenserver 🤔 Requests on the new Tokenserver will still take well over 1 ms to complete, so I think the only way this could happen would be if a client decided to bombard us with requests, and I think the old Tokenserver is just as vulnerable to that
Description
Add
time.sleep
s to fix an intermittent timestamp issue in a unit testTesting
The failing test should pass on CI
Issue(s)
Closes #1170