Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions keep/api/core/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def __get_conn_impersonate() -> pymysql.connections.Connection:
KEEP_DB_PRE_PING_ENABLED = config(
"KEEP_DB_PRE_PING_ENABLED", default=False, cast=bool
) # pylint: disable=invalid-name
DB_POOL_RECYCLE = config(
"DATABASE_POOL_RECYCLE", default=3600, cast=int
) # pylint: disable=invalid-name
DB_POOL_TIMEOUT = config(
"DATABASE_POOL_TIMEOUT", default=30, cast=int
) # pylint: disable=invalid-name


def dumps(_json) -> str:
Expand Down Expand Up @@ -160,6 +166,8 @@ def create_db_engine():
json_serializer=dumps,
echo=DB_ECHO,
pool_pre_ping=True if KEEP_DB_PRE_PING_ENABLED else False,
pool_recycle=DB_POOL_RECYCLE,
pool_timeout=DB_POOL_TIMEOUT,
)
# SQLite does not support pool_size
except TypeError:
Expand Down
8 changes: 8 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ def context_manager():
return ContextManager(tenant_id=SINGLE_TENANT_UUID, workflow_id="1234")


@pytest.fixture
def tenant_id():
"""
Provides the default single tenant UUID for tests.
"""
return SINGLE_TENANT_UUID


@pytest.fixture(scope="session")
def docker_services(
docker_compose_command,
Expand Down