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

[20] Auth token update improvements #33776

Closed
wants to merge 4 commits into from
Closed

Conversation

icewind1991
Copy link
Member

@icewind1991 icewind1991 commented Aug 31, 2022

ChristophWurst and others added 3 commits August 31, 2022 16:59
The auth token activity logic works as follows
* Read auth token
* Compare last activity time stamp to current time
* Update auth token activity if it's older than x seconds

This works fine in isolation but with concurrency that means that
occasionally the same token is read simultaneously by two processes and
both of these processes will trigger an update of the same row.
Affectively the second update doesn't add much value. It might set the
time stamp to the exact same time stamp or one a few seconds later. But
the last activity is no precise science, we don't need this accuracy.

This patch changes the UPDATE query to include the expected value in a
comparison with the current data. This results in an affected row when
the data in the DB still has an old time stamp, but won't affect a row
if the time stamp is (nearly) up to date.

This is a micro optimization and will possibly not show any significant
performance improvement. Yet in setups with a DB cluster it means that
the write node has to send fewer changes to the read nodes due to the
lower number of actual changes.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Signed-off-by: Joas Schilling <coding@schilljs.com>
Signed-off-by: Joas Schilling <coding@schilljs.com>
@icewind1991 icewind1991 added the 2. developing Work in progress label Aug 31, 2022
the debounce for updating last_activity is changed so it always updates if another field of the token has been updated, this ensures that last_check if updated even if last_activity is still in the debounce period.

Signed-off-by: Robin Appelman <robin@icewind.nl>
@blizzz
Copy link
Member

blizzz commented Jun 22, 2023

@icewind1991 what's the state about this PR?

@blizzz
Copy link
Member

blizzz commented Sep 13, 2023

after over a year I think we can close it.

@blizzz blizzz closed this Sep 13, 2023
@skjnldsv skjnldsv deleted the token-updates-20 branch March 14, 2024 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2. developing Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants