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

Separate token parsing from storage #652

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Separate token parsing from storage #652

merged 2 commits into from
Jun 10, 2024

Conversation

arner
Copy link
Contributor

@arner arner commented Jun 10, 2024

The existing implementation opens up a database transaction and then starts parsing the token request. This operation indirectly, via other structs, does a few database calls outside of the open db transaction. This causes failures when performing a large amount of concurrent transactions in specific configurations; specifically with sqlite as backend or with a low maximum of open database connections.

This PR splits out the parsing from the storing/deleting operations, to leave the db transaction open for as short as possible and free up resources again. As a bonus it improves the testability of the parsing.

Signed-off-by: Arne Rutjes <arne123@gmail.com>
Signed-off-by: Arne Rutjes <arne123@gmail.com>
@arner arner requested a review from adecaro June 10, 2024 08:58
Copy link
Contributor

@adecaro adecaro left a comment

Choose a reason for hiding this comment

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

LGTM

@adecaro adecaro self-assigned this Jun 10, 2024
@adecaro adecaro added the bug Something isn't working label Jun 10, 2024
@adecaro adecaro merged commit 0acbabf into main Jun 10, 2024
46 checks passed
@adecaro adecaro deleted the concurrency branch June 10, 2024 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants