Skip to content

Commit af01cce

Browse files
committed
fix: Oracle timeout #1360
1 parent 3f68b61 commit af01cce

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

backend/apps/db/db.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ def get_engine(ds: CoreDatasource, timeout: int = 0, use_pool: bool = False) ->
148148
'pool_size': conf.poolSize if conf.poolSize else 5,
149149
'max_overflow': 20,
150150
'pool_recycle': 3600,
151-
'pool_pre_ping': True
151+
'pool_pre_ping': True,
152+
'pool_timeout': conf.timeout if conf.timeout else 30
152153
} if use_pool else {
153154
'poolclass': NullPool
154155
}
@@ -164,7 +165,7 @@ def get_engine(ds: CoreDatasource, timeout: int = 0, use_pool: bool = False) ->
164165
engine = create_engine('mssql+pymssql://', creator=lambda: get_origin_connect(ds.type, conf),
165166
**db_config)
166167
elif equals_ignore_case(ds.type, 'oracle'):
167-
engine = create_engine(get_uri(ds), **db_config)
168+
engine = create_engine(get_uri(ds), connect_args={"tcp_connect_timeout": conf.timeout}, **db_config)
168169
elif equals_ignore_case(ds.type, 'mysql'): # mysql
169170
ssl_mode = {"require": True} if conf.ssl else None
170171
engine = create_engine(get_uri(ds), connect_args={"connect_timeout": conf.timeout, "ssl": ssl_mode},

0 commit comments

Comments
 (0)