From c2f91a140e2a0405f385767724425ee73f78f7f9 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Wed, 10 Jun 2020 16:21:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E8=B5=84=E6=BA=90=E6=B1=A0?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=98=AF=E5=90=A6=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=B6=85=E6=97=B6=E9=99=90?= =?UTF-8?q?=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/service/TestResourcePoolService.java | 7 +++++++ .../components/settings/system/TestResourcePool.vue | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java b/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java index a4b710c84b..8aa2c6977f 100644 --- a/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java +++ b/backend/src/main/java/io/metersphere/service/TestResourcePoolService.java @@ -19,6 +19,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; @@ -185,9 +186,15 @@ public class TestResourcePoolService { private boolean validateNode(NodeDTO node) { try { + HttpComponentsClientHttpRequestFactory httpRequestFactory = new HttpComponentsClientHttpRequestFactory(); + httpRequestFactory.setConnectionRequestTimeout(4000); + httpRequestFactory.setConnectTimeout(4000); + httpRequestFactory.setReadTimeout(5000); + restTemplate.setRequestFactory(httpRequestFactory); ResponseEntity entity = restTemplate.getForEntity(String.format(nodeControllerUrl, node.getIp(), node.getPort()), String.class); return HttpStatus.OK.equals(entity.getStatusCode()); } catch (Exception e) { + LogUtil.error(e); return false; } } diff --git a/frontend/src/business/components/settings/system/TestResourcePool.vue b/frontend/src/business/components/settings/system/TestResourcePool.vue index 0f2153632e..7f0005a255 100644 --- a/frontend/src/business/components/settings/system/TestResourcePool.vue +++ b/frontend/src/business/components/settings/system/TestResourcePool.vue @@ -48,7 +48,9 @@ :title="$t('test_resource_pool.create_resource_pool')" :visible.sync="createVisible" width="70%" @closed="closeFunc" - :destroy-on-close="true"> + :destroy-on-close="true" + v-loading="result.loading" + >