mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-06 05:58:46 +08:00
chore: fix typo
This commit is contained in:
parent
7b15215200
commit
dbfbf12ef2
@ -40,9 +40,8 @@ public class TaskRunnerClient {
|
|||||||
ResponseEntity<ResultHolder> entity = restTemplateWithTimeOut.exchange(u, HttpMethod.GET, httpEntity, ResultHolder.class);
|
ResponseEntity<ResultHolder> entity = restTemplateWithTimeOut.exchange(u, HttpMethod.GET, httpEntity, ResultHolder.class);
|
||||||
return entity.getBody();
|
return entity.getBody();
|
||||||
};
|
};
|
||||||
// 首次调用
|
|
||||||
ResultHolder body = action.execute(url, null);
|
return retry(url, null, action);
|
||||||
return retry(url, body, action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ResultHolder post(String url, Object requestBody) throws Exception {
|
public static ResultHolder post(String url, Object requestBody) throws Exception {
|
||||||
@ -56,20 +55,22 @@ public class TaskRunnerClient {
|
|||||||
restTemplateWithTimeOut.postForEntity(url, httpEntity, ResultHolder.class);
|
restTemplateWithTimeOut.postForEntity(url, httpEntity, ResultHolder.class);
|
||||||
return entity.getBody();
|
return entity.getBody();
|
||||||
};
|
};
|
||||||
// 首次调用
|
|
||||||
ResultHolder body = action.execute(url, requestBody);
|
return retry(url, requestBody, action);
|
||||||
return retry(url, body, action);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ResultHolder retry(String url, ResultHolder body, Action action) throws Exception {
|
private static ResultHolder retry(String url, Object requestBody, Action action) throws Exception {
|
||||||
|
// 首次调用
|
||||||
|
ResultHolder body = action.execute(url, requestBody);
|
||||||
if (body != null && body.getCode() == MsHttpResultCode.SUCCESS.getCode()) {
|
if (body != null && body.getCode() == MsHttpResultCode.SUCCESS.getCode()) {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 增加token失败重试
|
// 增加token失败重试
|
||||||
for (int i = 0; i < retryCount; i++) {
|
for (int i = 0; i < retryCount; i++) {
|
||||||
TimeUnit.MILLISECONDS.sleep(300);
|
TimeUnit.MILLISECONDS.sleep(300);
|
||||||
|
|
||||||
body = action.execute(url, null);
|
body = action.execute(url, requestBody);
|
||||||
// 重试后检查是否成功
|
// 重试后检查是否成功
|
||||||
if (body != null && body.getCode() == MsHttpResultCode.SUCCESS.getCode()) {
|
if (body != null && body.getCode() == MsHttpResultCode.SUCCESS.getCode()) {
|
||||||
return body;
|
return body;
|
||||||
|
Loading…
Reference in New Issue
Block a user