diff --git a/.github/workflows/dev.yaml b/.github/workflows/dev.yaml index f0ae30c..0392205 100644 --- a/.github/workflows/dev.yaml +++ b/.github/workflows/dev.yaml @@ -5,6 +5,7 @@ on: push: branches: - dev + - fix_db_connection_expiry jobs: build-and-deploy: diff --git a/app/utils/database/database.py b/app/utils/database/database.py index da167d8..6c8d5c3 100644 --- a/app/utils/database/database.py +++ b/app/utils/database/database.py @@ -15,7 +15,7 @@ def __init__(self, url: str, tables: list): def init_database(self): try: - self.engine = create_engine(self.url, echo=True) + self.engine = create_engine(self.url, echo=True, pool_pre_ping=True, pool_recycle=1800, pool_timeout=30) metadata = MetaData() metadata.reflect(self.engine, only=self.tables) self.Base.prepare(self.engine, reflect=True)