Skip to content

Commit

Permalink
add pool_recycle argument
Browse files Browse the repository at this point in the history
  • Loading branch information
ahdamin committed Sep 20, 2024
1 parent c035ad5 commit e244f67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions genotype_api/database/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from sqlalchemy.engine.reflection import Inspector
from sqlalchemy.orm import Session, scoped_session, sessionmaker

from genotype_api.exceptions import GenotypeDBError
from genotype_api.database.models import Base
from genotype_api.exceptions import GenotypeDBError

SESSION: scoped_session | None = None
ENGINE: Engine | None = None
Expand All @@ -16,7 +16,7 @@ def initialise_database(db_uri: str) -> None:
"""Initialize the SQLAlchemy engine and session for genotype api."""
global SESSION, ENGINE

ENGINE = create_engine(db_uri, pool_pre_ping=True)
ENGINE = create_engine(db_uri, pool_pre_ping=True, pool_recycle=3600)
session_factory = sessionmaker(ENGINE)
SESSION = scoped_session(session_factory)

Expand Down

0 comments on commit e244f67

Please sign in to comment.