瀏覽代碼

长文召回

wangyunpeng 11 月之前
父節點
當前提交
56d0c1bdce

+ 7 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/common/HttpPoolFactory.java

@@ -10,8 +10,15 @@ public final class HttpPoolFactory {
     private static CloseableHttpClient DEFAULT =
             HttpClientFactory.create(1000, 1000, 200, 200, 0, 1000);
 
+    private static CloseableHttpClient AIGC =
+            HttpClientFactory.create(10000, 10000, 200, 200, 0, 10000);
+
     public static CloseableHttpClient defaultPool() {
         return DEFAULT;
     }
 
+    public static CloseableHttpClient aigcPool() {
+        return AIGC;
+    }
+
 }

+ 3 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/remote/AIGCRemoteService.java

@@ -15,6 +15,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
 import org.springframework.stereotype.Service;
 
+import java.nio.charset.StandardCharsets;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
@@ -25,7 +26,7 @@ import java.util.Objects;
 @Service
 @Slf4j
 public class AIGCRemoteService {
-    private final CloseableHttpClient client = HttpPoolFactory.defaultPool();
+    private final CloseableHttpClient client = HttpPoolFactory.aigcPool();
     private static final String aigcGetAllContentUrl = "http://aigc-api.cybertogether.net/aigc/publish/content/gzhWaitingPublishContent";
 
 
@@ -40,7 +41,7 @@ public class AIGCRemoteService {
         bodyParam.put("params", bodyParamParams);
         try {
             HttpPost httpPost = new HttpPost(aigcGetAllContentUrl);
-            StringEntity stringEntity = new StringEntity(bodyParam.toJSONString());
+            StringEntity stringEntity = new StringEntity(bodyParam.toJSONString(), StandardCharsets.UTF_8);
             httpPost.setHeader("Content-Type", "application/json;charset=UTF-8");
             httpPost.setEntity(stringEntity);
             CloseableHttpResponse response = client.execute(httpPost);

+ 1 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recall/RecallService.java

@@ -52,7 +52,7 @@ public class RecallService implements ApplicationContextAware {
             recallResultFutures.add(future);
         }
         try {
-            cdl.await(3000, TimeUnit.MILLISECONDS);
+            cdl.await(10000, TimeUnit.MILLISECONDS);
         } catch (InterruptedException e) {
             log.error("recall error", e);
             return null;