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

Build API key: don't fetch and validate key twice #10488

Merged
merged 1 commit into from
Jun 28, 2023
Merged

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented Jun 27, 2023

There is some noticeable time increase when hitting our APIs using a token. We can also look into changing the hashing algorithm florimondmanca/djangorestframework-api-key#173 (comment) later.

Instead of relying on the parent method,
we just now override the whole method to have
access to the key itself.

Instead of relying on the parent method,
we just now override the whole method to have
access to the key itself.
@stsewd stsewd requested a review from a team as a code owner June 27, 2023 20:54
@stsewd stsewd requested a review from humitos June 27, 2023 20:54
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

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

It makes sense to not call the parent method and doing the same database queries again 👍

It's a bit silly that it has to be overwritten with almost identical code, but the parent methods weren't written to make it easy to get the key otherwise :(

@stsewd stsewd merged commit 8a7586b into main Jun 28, 2023
@stsewd stsewd deleted the dont-validate-key-twice branch June 28, 2023 17:02
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.

2 participants