# /opt/docker/dev/service_finder/backend/app/db/session.py from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession, async_sessionmaker from app.core.config import settings from typing import AsyncGenerator engine = create_async_engine( settings.DATABASE_URL, echo=False, future=True, pool_size=30, # A robotok száma miatt max_overflow=20, pool_pre_ping=True ) AsyncSessionLocal = async_sessionmaker( engine, class_=AsyncSession, expire_on_commit=False, autoflush=False ) async def get_db() -> AsyncGenerator[AsyncSession, None]: async with AsyncSessionLocal() as session: try: yield session # JAVÍTVA: Nincs automatikus commit! Az endpoint felelőssége. finally: await session.close()