adriangb / xpresso

A composable Python ASGI web framework
https://xpresso-api.dev/
MIT License
178 stars 4 forks source link

feat: support for BackgroundTasks #55

Open adriangb opened 2 years ago

adriangb commented 2 years ago

There are currently no tests and I'm pretty sure it doesn't work.

The tricky bit will be documenting the interaction between Response and BackgroundTasks

adriangb commented 2 years ago

Alternatively: we could just export ConnectionTasks = Annotated[anyio.abc.TaskGroup, Depends(anyio.create_task_group, scope="connection")] and AppTasks = Annotated[anyio.abc.TaskGroup, Depends(anyio.create_task_group, scope="app")], or write a tutorial on how to do this at least.