session maker updated

This commit is contained in:
berkay 2025-03-25 12:44:43 +03:00
parent bd428e2f58
commit f3b053af78
1 changed files with 2 additions and 2 deletions

View File

@ -14,7 +14,7 @@ engine = create_engine(
pool_pre_ping=True, # Verify connection before using
pool_size=20, # Maximum number of permanent connections
max_overflow=10, # Maximum number of additional connections
pool_recycle=3600, # Recycle connections after 1 hour
pool_recycle=600, # Recycle connections after 1 hour
pool_timeout=30, # Wait up to 30 seconds for a connection
echo=True, # Set to True for debugging SQL queries
)
@ -30,7 +30,7 @@ def get_session_factory() -> scoped_session:
bind=engine,
autocommit=False,
autoflush=False,
expire_on_commit=False, # Prevent expired object issues
expire_on_commit=True, # Prevent expired object issues
)
return scoped_session(session_local)