Skip to content

Commit

Permalink
fix: API 插件超时时间支持任务模块级别配置 TencentBlueKing#87
Browse files Browse the repository at this point in the history
  • Loading branch information
ZC-A committed Jan 7, 2025
1 parent 08e0acf commit f60035e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions env.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", "")
Expand Down
2 changes: 2 additions & 0 deletions module_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit f60035e

Please sign in to comment.