Skip to content
Merged
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
10 changes: 10 additions & 0 deletions keep/api/core/db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ def __get_conn_impersonate() -> pymysql.connections.Connection:
DB_MAX_OVERFLOW = config(
"DATABASE_MAX_OVERFLOW", default=10, cast=int
) # pylint: disable=invalid-name
DB_POOL_RECYCLE = config(
"DATABASE_POOL_RECYCLE", default=-1, cast=int
) # pylint: disable=invalid-name
DB_POOL_TIMEOUT = config(
"DATABASE_POOL_TIMEOUT", default=30, cast=int
) # pylint: disable=invalid-name
DB_ECHO = config(
"DATABASE_ECHO", default=False, cast=bool
) # pylint: disable=invalid-name
Expand Down Expand Up @@ -142,6 +148,8 @@ def create_db_engine():
json_serializer=dumps,
pool_size=DB_POOL_SIZE,
max_overflow=DB_MAX_OVERFLOW,
pool_recycle=DB_POOL_RECYCLE,
pool_timeout=DB_POOL_TIMEOUT,
)
elif DB_CONNECTION_STRING == "impersonate":
engine = create_engine(
Expand All @@ -157,6 +165,8 @@ def create_db_engine():
DB_CONNECTION_STRING,
pool_size=DB_POOL_SIZE,
max_overflow=DB_MAX_OVERFLOW,
pool_recycle=DB_POOL_RECYCLE,
pool_timeout=DB_POOL_TIMEOUT,
json_serializer=dumps,
echo=DB_ECHO,
pool_pre_ping=True if KEEP_DB_PRE_PING_ENABLED else False,
Expand Down
Loading