From ee1df265a8a1c9904505ec89c75d518fe7f5b044 Mon Sep 17 00:00:00 2001 From: 13009 Date: Tue, 24 Sep 2024 11:18:12 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9http=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E6=B1=A0=E5=A4=A7=E5=B0=8F=E4=B8=BA32?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/czcb/scfs/api/core/http/ConnPool.java | 4 ++-- .../com/czcb/scfs/api/core/http/ApiClientBuilderTest.java | 2 +- .../test/java/com/czcb/scfs/api/core/http/ConnPoolTest.java | 4 ++-- .../scfs/spring/boot/starter/ScfsApiGatewayProperties.java | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/scfs-api-core/src/main/java/com/czcb/scfs/api/core/http/ConnPool.java b/scfs-api-core/src/main/java/com/czcb/scfs/api/core/http/ConnPool.java index 0772e3b..293064d 100644 --- a/scfs-api-core/src/main/java/com/czcb/scfs/api/core/http/ConnPool.java +++ b/scfs-api-core/src/main/java/com/czcb/scfs/api/core/http/ConnPool.java @@ -72,11 +72,11 @@ public class ConnPool { public ConnPool build() { if (Objects.isNull(this.maxRequests) || this.maxRequests <= 0) { - this.maxRequests = 64; + this.maxRequests = 32; } if (Objects.isNull(this.maxRequestPerHost) || this.maxRequestPerHost <= 0) { - this.maxRequestPerHost = 64; + this.maxRequestPerHost = 32; } if (Objects.isNull(this.connectTimeout) || this.connectTimeout <= 0) { diff --git a/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ApiClientBuilderTest.java b/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ApiClientBuilderTest.java index 0e929bb..e60cfdc 100644 --- a/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ApiClientBuilderTest.java +++ b/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ApiClientBuilderTest.java @@ -63,7 +63,7 @@ class ApiClientBuilderTest { Assertions.assertNotNull(profile.getSignature()); assertThatJson("{\"appNo\":\"111111\",\"channelNo\":\"000000\",\"channelGroupMode\":false}").isEqualTo(profile.getChannel()); assertThatJson("{\"host\":\"http://127.0.0.1:8888\"," + - "\"connPool\":{\"maxRequests\":64,\"maxRequestPerHost\":64,\"connectTimeout\":10,\"socketTimeout\":60}," + + "\"connPool\":{\"maxRequests\":32,\"maxRequestPerHost\":32,\"connectTimeout\":10,\"socketTimeout\":60}," + "\"headers\":{}," + "\"proxy\":{\"enabled\":false,\"host\":null,\"port\":null,\"username\":\"\",\"password\":\"\",\"scheme\":\"http\"}}\n") .isEqualTo(profile.getHttpProfile()); diff --git a/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ConnPoolTest.java b/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ConnPoolTest.java index f972cb5..3d6d670 100644 --- a/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ConnPoolTest.java +++ b/scfs-api-core/src/test/java/com/czcb/scfs/api/core/http/ConnPoolTest.java @@ -8,8 +8,8 @@ class ConnPoolTest { void test() { ConnPool pool = new ConnPool.Builder().build(); Assertions.assertEquals(10, pool.getConnectTimeout()); - Assertions.assertEquals(64, pool.getMaxRequests()); - Assertions.assertEquals(64, pool.getMaxRequestPerHost()); + Assertions.assertEquals(32, pool.getMaxRequests()); + Assertions.assertEquals(32, pool.getMaxRequestPerHost()); Assertions.assertEquals(60, pool.getSocketTimeout()); } diff --git a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java index 93cdabc..ab87077 100644 --- a/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java +++ b/scfs-api-spring-boot-starter/src/main/java/com/czcb/scfs/spring/boot/starter/ScfsApiGatewayProperties.java @@ -145,11 +145,11 @@ public class ScfsApiGatewayProperties { /** * 最大连接数 */ - private Integer maxRequests = 64; + private Integer maxRequests = 32; /** * 每个路由最大连接数 */ - private Integer maxRequestPerHost = 64; + private Integer maxRequestPerHost = 32; /** * http 连接超时时间 默认10秒 */