|
@@ -2,8 +2,8 @@ package com.tzld.longarticle.recommend.server.remote.aigc;
|
|
|
|
|
|
import cn.hutool.core.io.resource.ResourceUtil;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.tzld.longarticle.recommend.server.common.HttpPoolFactory;
|
|
|
import com.tzld.longarticle.recommend.server.model.vo.IdNameVO;
|
|
|
+import com.tzld.longarticle.recommend.server.util.HttpClientFactory;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.http.HttpEntity;
|
|
|
import org.apache.http.StatusLine;
|
|
@@ -22,9 +22,22 @@ import java.util.Objects;
|
|
|
@Slf4j
|
|
|
public class AIGCCrawlerPlanSaveService {
|
|
|
|
|
|
- private final CloseableHttpClient client = HttpPoolFactory.aigcPool();
|
|
|
+ private final CloseableHttpClient client =
|
|
|
+ HttpClientFactory.create(10000, 120000, 200, 200, 0, 10000);
|
|
|
|
|
|
public IdNameVO<String> createArticleUrlPlan(String planName, List<String> contentList, String tag, Integer crawlerMode) {
|
|
|
+ int retryTimes = 2;
|
|
|
+ while (retryTimes > 0) {
|
|
|
+ IdNameVO<String> result = post(planName, contentList, tag, crawlerMode);
|
|
|
+ if (Objects.nonNull(result)) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ retryTimes--;
|
|
|
+ }
|
|
|
+ return new IdNameVO<>();
|
|
|
+ }
|
|
|
+
|
|
|
+ public IdNameVO<String> post(String planName, List<String> contentList, String tag, Integer crawlerMode) {
|
|
|
IdNameVO<String> result = new IdNameVO<>();
|
|
|
if (contentList == null || contentList.isEmpty()) {
|
|
|
return null;
|
|
@@ -67,9 +80,10 @@ public class AIGCCrawlerPlanSaveService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ return result;
|
|
|
} catch (Exception e) {
|
|
|
log.error("createArticleUrlPlan error", e);
|
|
|
}
|
|
|
- return result;
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|