feat(db): 调整统一管理事务方式

This commit is contained in:
xingc
2025-04-16 14:40:19 +08:00
parent 0ca327f56a
commit 94ddc6b926
2 changed files with 81 additions and 82 deletions

View File

@@ -35,7 +35,8 @@ session_maker = async_sessionmaker(engine, class_=AsyncSession, expire_on_commit
async def get_async_session() -> AsyncGenerator[AsyncSession, None]:
async with session_maker() as session:
yield session
async with session.begin():
yield session
def create_redis_pool():