From af01cce9ca4b9ed5da864c32d1a100b67f13a165 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 11 Sep 2026 14:11:29 +0800 Subject: [PATCH] fix: Oracle timeout #1360 --- backend/apps/db/db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/apps/db/db.py b/backend/apps/db/db.py index 2226f9cb..eb514357 100644 --- a/backend/apps/db/db.py +++ b/backend/apps/db/db.py @@ -148,7 +148,8 @@ def get_engine(ds: CoreDatasource, timeout: int = 0, use_pool: bool = False) -> 'pool_size': conf.poolSize if conf.poolSize else 5, 'max_overflow': 20, 'pool_recycle': 3600, - 'pool_pre_ping': True + 'pool_pre_ping': True, + 'pool_timeout': conf.timeout if conf.timeout else 30 } if use_pool else { 'poolclass': NullPool } @@ -164,7 +165,7 @@ def get_engine(ds: CoreDatasource, timeout: int = 0, use_pool: bool = False) -> engine = create_engine('mssql+pymssql://', creator=lambda: get_origin_connect(ds.type, conf), **db_config) elif equals_ignore_case(ds.type, 'oracle'): - engine = create_engine(get_uri(ds), **db_config) + engine = create_engine(get_uri(ds), connect_args={"tcp_connect_timeout": conf.timeout}, **db_config) elif equals_ignore_case(ds.type, 'mysql'): # mysql ssl_mode = {"require": True} if conf.ssl else None engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": ssl_mode},