-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Cache users by objectID, and clear cache when updated via master key (fixes #1836) #1844
Cache users by objectID, and clear cache when updated via master key (fixes #1836) #1844
Conversation
Current coverage is 91.97%
@@ master #1844 diff @@
==========================================
Files 91 91
Lines 6363 6362 -1
Methods 1096 1096
Messages 0 0
Branches 1332 1332
==========================================
- Hits 5854 5851 -3
- Misses 509 511 +2
Partials 0 0
|
Where do we actually query this? if you change the put key, you will need to change the get key? |
Oh yeah good point. We should probably have a test to ensure that the cache actually gets used.. |
…sion when user is modified with Master Key (ew, hopefully that can be improved later)
@drew-gross updated the pull request. |
// Update was made with master key, so we don't have the session. Query to find it. Hopefully we can make this faster later, somehow. | ||
let userObject = Parse.Object.createWithoutData('_User', this.data.objectId); | ||
let sessionsQuery = new Parse.Query('_Session'); | ||
//sessionsQuery.equalTo('user', userObject); |
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.
Should this line be commented out? Seems like there are no constraints on the query?
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.
Nope I'm still working on this PR. The original issue was when a user was updated via master key, but the same issue will show up if the user is updated via one session token and the read via a different one. I'll mark is as WIP.
@drew-gross updated the pull request. |
@drew-gross updated the pull request. |
@drew-gross updated the pull request. |
@blacha this PR is finished now. |
looks good to me. |
…ixes parse-community#1836) (parse-community#1844) * Cache users by objectID, and clear cache when updated via master key * Go back to caching by session token. Clear out cache by querying _Session when user is modified with Master Key (ew, hopefully that can be improved later) * Fix issue with user updates from different sessions causing stale reads * Tests aren't transpiled... * Still not transpiled
Previously users were cached by session token, which doesn't work when using master key to update a user, as we don't know the session token, and would have to do an extra query to get it. This caches by objectId so that they user cache can be cleared when the user is updated via master key.