-
-
Notifications
You must be signed in to change notification settings - Fork 360
[16.0][FIX] fastapi: Ensure no default eventloop thread is created #508
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
Conversation
Before this change, an eventloop thread was created on each instanciation of the ASGIMiddleware class. We want to avoid this behavior to avoid the creation of zombie threads
8d8d5a7 to
5505a6a
Compare
| # Since the the base class check if the given loop is | ||
| # None, we can pass False to avoid the initialization | ||
| # of the default event loop | ||
| super().__init__(app, wait_time, False) |
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.
A bit hacky but I don't see any other option.
| def __init__( | ||
| self, | ||
| app: ASGIApp, | ||
| wait_time: float | None = None, |
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.
Shouldn't we need to keep the parent signature?
loop: Optional[asyncio.AbstractEventLoop] = None,
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.
IMO no. This class is designed to be used in the specific context of the fastapi addon where we enforce the use of the pool of eventloop threads.
|
/ocabot merge minor |
|
What a great day to merge this nice PR. Let's do it! |
|
Congratulations, your PR was merged at 90ae5a4. Thanks a lot for contributing to OCA. ❤️ |
Before this change, an eventloop thread was created on each instanciation of the ASGIMiddleware class. We want to avoid this behavior to avoid the creation of zombie threads