Sfoglia il codice sorgente

修改排序超时时间

xueyiming 7 mesi fa
parent
commit
57e7e8c9dc

+ 1 - 1
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/local/impl/CoreServiceImpl.java

@@ -416,7 +416,7 @@ public class CoreServiceImpl implements CoreService {
             // 启动消费者线程
             for (int i = 0; i < threadSize; i++) {
                 matchPoolExecutor.submit(new Thread(() -> {
-                    log.info("启动匹配小程序线程");
+                    log.info("启动核心操作线程");
                     while (true) {
                         try {
                             // 超过 5 分钟没有数据,销毁当前线程

+ 11 - 15
long-article-server/src/main/java/com/tzld/piaoquan/longarticle/service/remote/impl/SortServiceImpl.java

@@ -22,23 +22,19 @@ public class SortServiceImpl implements SortService {
     public ArticleSortResponse publishArticleSort(ArticleSortRequest request) {
         ArticleSortResponse response = new ArticleSortResponse();
         String apiUrl = "http://101.37.174.139:80/recommend";
-        int retryTimes = 2;
-        while (retryTimes > 0) {
-            try {
-                HttpPoolClientUtil HTTP_POOL_CLIENT_UTIL_DEFAULT = HttpClientUtil.create(5000, 500000, 5, 10, 3, 3000);
-                retryTimes--;
-                String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.post(apiUrl, JSON.toJSONString(request));
-                log.info("publishArticleSort res={}", res);
-                response = JSON.parseObject(res, ArticleSortResponse.class);
-                if (Objects.nonNull(response) && Objects.nonNull(response.getData())) {
-                    response.setSuccessful(true);
-                    if (CollectionUtil.isNotEmpty(response.getData().getRank_list())) {
-                        break;
-                    }
+        try {
+            HttpPoolClientUtil HTTP_POOL_CLIENT_UTIL_DEFAULT = HttpClientUtil.create(5000, 200000, 5, 10, 3, 3000);
+            String res = HTTP_POOL_CLIENT_UTIL_DEFAULT.post(apiUrl, JSON.toJSONString(request));
+            log.info("publishArticleSort res={}", res);
+            response = JSON.parseObject(res, ArticleSortResponse.class);
+            if (Objects.nonNull(response) && Objects.nonNull(response.getData())) {
+                response.setSuccessful(true);
+                if (CollectionUtil.isNotEmpty(response.getData().getRank_list())) {
+                    return response;
                 }
-            } catch (Exception e) {
-                log.error("publishArticleSort recommend response parseObject", e);
             }
+        } catch (Exception e) {
+            log.error("publishArticleSort recommend response parseObject", e);
         }
         return response;
     }