-
Notifications
You must be signed in to change notification settings - Fork 132
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
Clear cache and refresh user profile on email verification #1970
Conversation
94a2f22
to
29755af
Compare
@@ -100,7 +100,8 @@ def serializer_from_settings(): | |||
|
|||
|
|||
def set_is_email_verified(profile, is_email_verified): | |||
profile.metadata.update({"is_email_verified": is_email_verified}) | |||
profile.refresh_from_db() |
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.
Can we make this call before we call set_is_email_verified()
? I see a reason why the refresh_from_db
may need to happen on the GET request to verify, but perhaps not on the POST request. I would hope all requests on a POST use the master DB.
Is this issue due to a read replica update delay?
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.
Yes, I can change this.
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.
Doesn't seem to be a read replica update delay; the change never shows up. Noticed accounts that had been verified a while back(2-3 days) but the metadata wasn't updated
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.
What then guarantees this issue is resolved considering the statement has always been there? The only new statements is the cache deletion and the refresh_from_db.
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.
Changed this in the latest commits. The main issue seems to have been the RegistrationProfile
retrieval in the user profile viewset.
29755af
to
39ab3f6
Compare
Caching the userprofile on retrieval seems like premature optimization we've not necessarily encountered any issues with reading directly from a read replica or master that would warrant caching the profile.
39ab3f6
to
ea6821c
Compare
0be8d68
to
ee1923d
Compare
Changes / Features implemented
Steps taken to verify this change does what is intended
Side effects of implementing this change
Possible fix for #1948