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

Add limited Okta connection pooling #139

Merged
merged 3 commits into from
Sep 12, 2024

Conversation

barborico
Copy link
Contributor

@barborico barborico commented Sep 11, 2024

Motivation

This PR introduces limited connection pooling for requests from Access to Okta. The intent is to avoid creating excessive connections, e.g. in case of Okta API degradation resulting in timeouts. Although the aiohttp docs for ClientSession state that "it is suggested you use a single session for the lifetime of your application to benefit from connection pooling," this isn't feasible due to the synchronous nature of the Access Flask app. Instead, we introduce a session with each async event loop to call the Okta API. This should at least consolidate retries and paginated requests to a single connection.

Reviewing

Hide whitespace, since most of the changed lines are simply indented.

@barborico barborico marked this pull request as ready for review September 11, 2024 18:53
api/services/okta_service.py Outdated Show resolved Hide resolved
@barborico barborico merged commit ddbed73 into main Sep 12, 2024
6 checks passed
@barborico barborico deleted the barborico/okta_connection_pooling branch September 12, 2024 18:59
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