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

[FTR] feature/thread-limiter | Add anyio thread limiter #290

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

Aleksandar1932
Copy link
Contributor

@Aleksandar1932 Aleksandar1932 commented Aug 26, 2022

This PR addresses the issue explained in #289 by limiting the number of threads in the managed thread pool by anyio.

Relate to the discussion in #tiangolo/fastapi/4221 and an additional click option is added to specify the number of threads. This PR should serve as an extension to the current implementation and if no thread limit is specified the server should work as previously and thus be able to reproduce #289.

However, if a thread limit is specified the response time will increase proportionally to the number of simultaneous requests, thus avoiding spawning threads until memory is filled.

@danielgatis danielgatis merged commit 7854288 into danielgatis:main Aug 27, 2022
@danielgatis
Copy link
Owner

wow! thank you so much!

@cprodhomme
Copy link

@danielgatis do you have an idea when a new version with this PR will release ? please 🙏

@danielgatis
Copy link
Owner

@danielgatis do you have an idea when a new version with this PR will release ? please 🙏

https://github.com/danielgatis/rembg/releases/tag/v2.0.25

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.

3 participants