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

asgi: import app and start app in same event loop #257

Open
trim21 opened this issue Sep 11, 2024 · 0 comments
Open

asgi: import app and start app in same event loop #257

trim21 opened this issue Sep 11, 2024 · 0 comments

Comments

@trim21
Copy link

trim21 commented Sep 11, 2024

hypercorn import package and run asgi in different event loop. make it hard to call asyncio.get_event_loop() to get event loop on module init, and use it in asgi application.

For example, this works fine with uvicorn:

pg = asyncpg.create_pool(dsn=PG_DSN)

# asgi lifespan
async def startup():
    await pg

this will cause RuntimeError: Task <Task pending name='Task-2' coro=<Lifespan.handle_lifespan() running at ...\hypercorn\asyncio\lifespan.py:55>> got Future <_OverlappedFuture pending overlapped=<pending, 0x17c193fcf70>> attached to a different loop

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

No branches or pull requests

1 participant