Commit f02fc195 authored by 金凯强's avatar 金凯强 🎨

数据库连接测试报错信息修改

parent 05f33d4f
Pipeline #22243 failed with stage
in 11 seconds
......@@ -22,7 +22,7 @@ class CommonTools:
raise HSException(f"{key}不能为空")
# 超过四秒,基本上没救了,告辞~~~~
@timeout_decorator.timeout(4)
@timeout_decorator.timeout(2)
def test_db_connection(cls, ip: int, port: int, user_name: str, password: str, db_name: str):
'''
测试数据库连接
......@@ -56,6 +56,9 @@ class CommonTools:
return False
except Exception as e:
if isinstance(e, TimeoutError):
logger.error("数据库连接失败,失败原因:{}".format(e))
return False
orig = getattr(e, 'orig')
args = getattr(orig, 'args', ((),))[0]
error_message = ''
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment