|
@@ -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;
|
|
|
}
|