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

Make sure to not call sync IO functions inside async functions #615

Merged
merged 7 commits into from
Nov 13, 2024

Conversation

Krismix1
Copy link
Contributor

I found that several sync IO functions are used inside of async functions. This is not good, as sync IO may block the eventloop for undetermined amount of time.
I had to add a new _a_token_info that mimics _token_info; the only difference is that it calls the async alternatives inside.
I think those should be all the places where a sync IO was made.

I also found another discrepancy between requests and httpx - httpx does not handle sets for form-data requests.
Encoding in requests vs httpx. httpx doesn't mention anything about support or lack of it for sets. Perhaps it could be reasonable for it to be fixed upstream.
Luckily some tests for a_uma_permissions caught this.

For now I fixed the problem inside the function itself.
The only other place I see where this could need a similar fix is KeycloakOpenID.a_token, which takes a user-supplied dict (the extra) and passes it as is to httpx.

Copy link
Collaborator

@ryshoooo ryshoooo left a comment

Choose a reason for hiding this comment

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

Thanks a lot @Krismix1 LGTM

@ryshoooo ryshoooo merged commit 239e404 into marcospereirampj:master Nov 13, 2024
4 of 5 checks passed
@Krismix1 Krismix1 deleted the hotfix/async-in-async branch November 16, 2024 11:24
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