Conversation
c73de55 to
f0ee517
Compare
|
@bdarnell when you've got a moment, it would be great if you could have a quick look to see if I'm going in the direction you'd expect, both in the implementation and in the tests. It's relatively easy to make bigger changes while the added code is quite small. There are 2 main new classes:
Things I'm aware of that the tests should cover:
(I'm sure that's not exhaustive, just writing down what I can think of now) |
bdarnell
left a comment
There was a problem hiding this comment.
This is looking good; I apologize for the slow response.
One thing to watch out for in testing error cases is that moving things into bg_task doesn't cause exceptions to be raised in a different context than they should be.
888a7bf to
4231e04
Compare
|
Thanks, and no worries about the wait, I know how this can feel from the maintainer side. Good point about error handling. I think this is primarily up to application code. If a RequestHandler calls e.g. Commit 311e807 adds a draft implementation of the lifespan protocol, which allows for async startup & shutdown of the application. I'm experimenting with an idea to do this based around an async generator function: @ASGIAdapter
def asgi_main():
# async startup, e.g.
db_conn = await connect_to_database()
yield Application(...)
# async shutdown, e.g.
await db_conn.aclose()I like this because you don't create a partly initialised |
Basic support for wrapping a tornado web
Applicationclass and serving HTTP requests through an ASGI server.This obviously needs tests, but I've been able to start a server and serve a basic request locally: