diff --git a/bkflow/pipeline_plugins/components/collections/uniform_api/v2_0_0.py b/bkflow/pipeline_plugins/components/collections/uniform_api/v2_0_0.py index 68694ad..6aa4eca 100644 --- a/bkflow/pipeline_plugins/components/collections/uniform_api/v2_0_0.py +++ b/bkflow/pipeline_plugins/components/collections/uniform_api/v2_0_0.py @@ -270,7 +270,11 @@ def _dispatch_schedule_polling(self, data, parent_data, callback_data=None): ) try: request_result: HttpRequestResult = client.request( - url=polling_config.url, method="get", data=api_data, headers=headers, timeout=30 + url=polling_config.url, + method="get", + data=api_data, + headers=headers, + timeout=settings.BKAPP_ENGINE_PLUGIN_TIMEOUT, ) except Exception as e: message = handle_plain_log("[uniform_api polling error] url request failed: {}".format(e)) diff --git a/env.py b/env.py index 11f0d90..e0e2d54 100644 --- a/env.py +++ b/env.py @@ -75,6 +75,9 @@ # 默认引擎模块入口 BKAPP_DEFAULT_ENGINE_MODULE_ENTRY = os.getenv("BKAPP_DEFAULT_ENGINE_MODULE_ENTRY", "") +# 默认引擎插件超时时间 +BKAPP_ENGINE_PLUGIN_TIMEOUT = os.getenv("BKAPP_ENGINE_PLUGIN_TIMEOUT", 30) + CALLBACK_KEY = os.getenv("BKFLOW_DEFAULT_CALLBACK_KEY", "").encode("utf-8") BK_PAAS_ESB_HOST = os.getenv("BK_COMPONENT_API_URL", "") diff --git a/module_settings.py b/module_settings.py index fd80274..760346a 100644 --- a/module_settings.py +++ b/module_settings.py @@ -133,6 +133,8 @@ def check_engine_admin_permission(request, *args, **kwargs): PIPELINE_ENGINE_ADMIN_API_PERMISSION = "module_settings.check_engine_admin_permission" + BKAPP_ENGINE_PLUGIN_TIMEOUT = env.BKAPP_ENGINE_PLUGIN_TIMEOUT + INSTALLED_APPS += ( "rest_framework", "drf_yasg",