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

Use thread-safe API to call things on ASGIResponder.loop #54

Closed
wants to merge 1 commit into from

Conversation

encukou
Copy link
Contributor

@encukou encukou commented May 7, 2024

This wraps calls to the event loop in thread-safe functions.
PYTHONASYNCIODEBUG is added to GitHub actions to detect similar issues.

There might be a more elegant way to do this, but I didn't find it.

Fixes: #53

# activate loop
self.loop.call_soon_threadsafe(lambda: None)
asgi_task = self.call_in_loop(self.start_asgi_app, environ)
Copy link
Owner

@abersheeran abersheeran May 28, 2024

Choose a reason for hiding this comment

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

Thank you for your enthusiasm, but you did not understand the original purpose here.

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.

ASGIMiddleware uses non-threadsafe asyncio API
2 participants