Conversation
| - Exceptions: 'exceptions.md' | ||
| - Configuration: 'config.md' | ||
| - Test Client: 'testclient.md' | ||
| - Sync Threadpools: 'threadpools.md' |
There was a problem hiding this comment.
I think it's not that easy to find this in the docs, if you don't know that you should look for the threadpool docs.
There was a problem hiding this comment.
Agreed but can't think of a better name right now. @Kludex any ideas?
There was a problem hiding this comment.
"Sync" threadpools, as opposed to what?
| # Set number of threads in threadpool to 100 | ||
| anyio.to_thread.current_default_thread_limiter().total_tokens = 100 |
There was a problem hiding this comment.
| # Set number of threads in threadpool to 100 | |
| anyio.to_thread.current_default_thread_limiter().total_tokens = 100 | |
| # Set number of threads in threadpool to 100 | |
| # Note that this increases the limit for anything using AnyIO, not just Starlette | |
| anyio.to_thread.current_default_thread_limiter().total_tokens = 100 |
There was a problem hiding this comment.
Devil's advocate: if we document this would it then be breaking change if we start using our own capacity limiter(s), meaning this stops working? I think not, it's okay to break docs to some extent.
There was a problem hiding this comment.
We can update the docs when we add the CapacityLimiter to explain this.
| - Exceptions: 'exceptions.md' | ||
| - Configuration: 'config.md' | ||
| - Test Client: 'testclient.md' | ||
| - Sync Threadpools: 'threadpools.md' |
There was a problem hiding this comment.
Agreed but can't think of a better name right now. @Kludex any ideas?
Co-authored-by: Adrian Garcia Badaracco <1755071+adriangb@users.noreply.github.com>
| from starlette.routing import Route | ||
|
|
||
| # Set number of threads in threadpool to 100 | ||
| anyio.to_thread.current_default_thread_limiter().total_tokens = 100 |
There was a problem hiding this comment.
Doesn't this needs to be in the lifespan if using multiple workers?
There was a problem hiding this comment.
I think each worker will do this, so there’s no difference.
but I can do a quick test to confirm
There was a problem hiding this comment.
Each worker runs in a separate process, right?
|
@aminalaee Do you still want to work on this? |
|
I'm closing this as stale. Please reopen if you still want to work on it, or if someone else wants to take it over, go ahead. |
Related to #1724
Summary
Checklist