From aa95e79723e16e675c725f30dba37ec52e9d73fb Mon Sep 17 00:00:00 2001 From: Rob Cannon Date: Sat, 30 Nov 2024 13:09:27 +0700 Subject: [PATCH] fix: session close logic --- icon_stats/db.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/icon_stats/db.py b/icon_stats/db.py index 150c081..852ffae 100644 --- a/icon_stats/db.py +++ b/icon_stats/db.py @@ -71,10 +71,8 @@ async def get_session(db_name: str = "stats"): async with session_factories[db_name]() as session: try: yield session - except Exception as e: - await session.rollback() + finally: await session.close() - raise e # Generic sqlmodel table