1
0
mirror of https://git.sr.ht/~tsileo/microblog.pub synced 2025-06-05 21:59:23 +02:00

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()