Switch to raw ASGI middleware

This commit is contained in:
Thomas Sileo 2022-07-14 12:13:23 +02:00
parent dd50db40d9
commit a39f874ad5
4 changed files with 107 additions and 60 deletions

View file

@ -29,4 +29,7 @@ def now() -> datetime.datetime:
async def get_db_session() -> AsyncGenerator[AsyncSession, None]:
async with async_session() as session:
yield session
try:
yield session
finally:
await session.close()