From 1135a5e44d3069eda16d60cd950aa2933f9e281a Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Wed, 23 Jul 2025 15:36:29 +0200 Subject: [PATCH] chore: Sets sqlalchemy pool_size and max overflow to a hard limit instead of default values (#1133) ## Description Sets sqlalchemy pool_size and max overflow to a hard limit instead of default values ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin. --- .../relational/sqlalchemy/SqlAlchemyAdapter.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py b/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py index 9238ac357..8ac8d04c4 100644 --- a/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py +++ b/cognee/infrastructure/databases/relational/sqlalchemy/SqlAlchemyAdapter.py @@ -49,9 +49,16 @@ class SQLAlchemyAdapter: run_sync(self.pull_from_s3()) - self.engine = create_async_engine( - connection_string, poolclass=NullPool if "sqlite" in connection_string else None - ) + if "sqlite" in connection_string: + self.engine = create_async_engine( + connection_string, + poolclass=NullPool, + ) + else: + self.engine = create_async_engine( + connection_string, pool_size=12, max_overflow=12, poolclass=None + ) + self.sessionmaker = async_sessionmaker(bind=self.engine, expire_on_commit=False) async def push_to_s3(self) -> None: