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

Fix missing token update when another field (e.g. last checked) changed #29681

Closed
wants to merge 3 commits into from

Conversation

nickvergessen
Copy link
Member

@nickvergessen
Copy link
Member Author

/backport to stable23

@nickvergessen
Copy link
Member Author

/backport to stable22

Copy link
Member

@CarlSchwan CarlSchwan left a comment

Choose a reason for hiding this comment

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

Change make sense

Signed-off-by: Joas Schilling <[email protected]>
@@ -128,6 +128,8 @@ public function updateTokenActivity(IToken $token) {
// Update token only once per minute
$token->setLastActivity($now);
$this->mapper->update($token);
} elseif (!empty($token->getUpdatedFields())) {
$this->mapper->update($token);
Copy link
Member

Choose a reason for hiding this comment

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

while this fixes the issue it's weird that we do this regular update in a updateTokenActivity method, isn't it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Only alternate approach is to either bring the double update back, or to move the acivity time calculation to the session and make the "which update to use" decision there:

$this->tokenProvider->updateTokenActivity($dbToken);
return true;

Copy link
Member

Choose a reason for hiding this comment

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

I think the double update is the subjectively cleanest as changes are written right where they are made

Copy link
Member Author

Choose a reason for hiding this comment

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

Also fine by me

@szaimen szaimen requested a review from PVince81 November 12, 2021 13:06
@nickvergessen
Copy link
Member Author

Replaced by #29682

@szaimen szaimen deleted the bugfix/29678/fix-token-update branch November 12, 2021 13:48
@MichaIng MichaIng removed this from the Nextcloud 24 milestone Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

22.2.1 is very slow
4 participants