-
Notifications
You must be signed in to change notification settings - Fork 98
Add executor parameter to AsyncClient #578
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
base: main
Are you sure you want to change the base?
Add executor parameter to AsyncClient #578
Conversation
|
Meir Elbaz seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Allowing passing |
|
Yes, it would be better to omit the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @meirdev, thanks! Overall looks good and will be useful for when users want to share a single ThreadPoolExecutor across multiple AsyncClient instances (e.g. to limit total resource usage) or when they want to use the app's existing executor for easier thread pool management. As for the PR, I think we'll just want to make the type hints more explicit and prevent allowing executor_threads to be None.
|
ok looks good! To merge this, we'll still need you to sign the CLA with your github email. Please see this comment. Thanks!
As a side note, the whole typing thing revealed a bug that stems from the |
Summary
Currently
AsyncClientcreates aThreadPoolExecutorin its constructor, I suggest allowing it to pass aThreadPoolExecutorto solve two things:AsyncClientis needed, there is no need to create aThreadPoolExecutorfor each connection.run_in_executorfunction in his program, there is already aThreadPoolExecutorthat can be used and there is no need to create a new one.Checklist