Skip to content
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 the session-user cache when changing _User objects #1072

Merged
merged 1 commit into from
Mar 18, 2016

Conversation

gfosco
Copy link
Contributor

@gfosco gfosco commented Mar 17, 2016

For issue #1062

@codecov-io
Copy link

Current coverage is 91.67%

Merging #1072 into master will increase coverage by +0.01% as of a08e2c2

@@            master   #1072   diff @@
======================================
  Files           74      74       
  Stmts         4452    4454     +2
  Branches       890     891     +1
  Methods          0       0       
======================================
+ Hit           4081    4083     +2
  Partial         10      10       
  Missed         361     361       

Review entire Coverage Diff as of a08e2c2

Powered by Codecov. Updated on successful CI builds.

@@ -341,6 +341,11 @@ RestWrite.prototype.transformUser = function() {
});
}

// If we're updating a _User object, clear the user cache for the session
Copy link
Contributor

Choose a reason for hiding this comment

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

Also when we have the oauthLogin shortcut?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean here..

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean when we do the login shortcut with oAuth, we go through that method. If there is a cached token for the found user, we should destroy it too to remove any wrong possible state, the same way we remove it upon user login

@mullwaden
Copy link

Thanks @gfosco !

Does it also solve for the following case where we have a user with a pointer to a second object (privateData)?

  • some change is made to the user such that the privateData is included in the cache (this seems to happen)
  • I make a change to the privateData object (without touching the user)
  • I create a new object card details (on which I use cardDetails.set('user', request.user)

Will there be an old version of the "privateData" object tagging along with the cardDetails?

@flovilmart flovilmart self-assigned this Mar 17, 2016
@gfosco
Copy link
Contributor Author

gfosco commented Mar 17, 2016

I don't think it would solve that case, no. I think you should perform a fetch on any included objects.

Since we store the user cache based on sessionToken, it also wouldn't support changes to that user made by the masterKey. We'd have to search through all the sessions to invalidate any matching that user...

@flovilmart flovilmart assigned gfosco and unassigned flovilmart Mar 18, 2016
gfosco added a commit that referenced this pull request Mar 18, 2016
Clear the session-user cache when changing _User objects
@gfosco gfosco merged commit 5decaec into master Mar 18, 2016
@gfosco gfosco deleted the fosco.user-cache branch March 18, 2016 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants