asyncgenerator fix
This commit is contained in:
@@ -64,14 +64,14 @@ Resolve settings at the composition boundary and call `get_engine(settings.datab
|
||||
The lifespan context manager only connects the cached resource to FastAPI ownership:
|
||||
|
||||
```python
|
||||
from collections.abc import AsyncIterator
|
||||
from collections.abc import AsyncGeneratorr
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
|
||||
async def lifespan(app: FastAPI) -> AsyncGenerator[None]:
|
||||
database_url = app.state.settings.database_url
|
||||
engine = get_engine(database_url)
|
||||
app.state.engine = engine
|
||||
|
||||
Reference in New Issue
Block a user