task-77: 统一 Coze、品牌检查和紫鸟 HTTP 客户端的连接复用策略

This commit is contained in:
2026-08-30 21:08:28 +08:00
parent d8682bb4a1
commit 295cdc815c
5 changed files with 253 additions and 12 deletions
@@ -15,6 +15,8 @@ import org.springframework.stereotype.Component;
import org.springframework.util.StreamUtils;
import org.springframework.web.client.RestClient;
import com.nanri.aiimage.config.HttpClientPool;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -749,10 +751,9 @@ public class SimilarAsinCozeClient {
}
synchronized (this) {
if (sharedRestClient == null) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(properties.getCozeConnectTimeoutMillis());
requestFactory.setReadTimeout(properties.getCozeReadTimeoutMillis());
sharedRestClient = RestClient.builder().requestFactory(requestFactory).build();
sharedRestClient = RestClient.builder()
.requestFactory(HttpClientPool.requestFactory(properties.getCozeReadTimeoutMillis()))
.build();
}
return sharedRestClient;
}