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

refactor: cache FxA OAuth client #1212

Merged
merged 5 commits into from
Feb 6, 2022

Conversation

ethowitz
Copy link
Contributor

@ethowitz ethowitz commented Feb 4, 2022

Description

Caches the PyFxA OAuth client to reduce memory churn and to take advantage of HTTP keep-alive.

Testing

This is covered by the end-to-end integration tests.

Issue(s)

Closes #1209

@ethowitz ethowitz requested a review from a team February 4, 2022 00:13
@ethowitz
Copy link
Contributor Author

ethowitz commented Feb 4, 2022

I just ran the load tests against this branch and it had a huge impact on performance: the median request time went from ~800ms to ~11ms 🤯

Copy link
Member

@pjenvey pjenvey left a comment

Choose a reason for hiding this comment

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

looks good otherwise

let code = include_str!("verify.py");
let module = PyModule::from_code(py, code, Self::FILENAME, Self::FILENAME)?;
let kwargs = fxa_oauth_server_url
.clone()
Copy link
Member

Choose a reason for hiding this comment

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

nit: this clone (or alternatively the other in ServerState::from_settings) isn't needed.

@ethowitz ethowitz requested a review from pjenvey February 4, 2022 20:44
@ethowitz ethowitz merged commit 04b2437 into master Feb 6, 2022
@ethowitz ethowitz deleted the refactor/1209-cache-fxa-oauth-client branch February 6, 2022 01:49
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.

Cache FxA OAuth client
2 participants