refactor(接口测试): 发送执行任务,响应超时不重试
--bug=1048936 --user=陈建星 [测试计划]github#34183多资源池节点执行测试计划会导致报告显示步骤重复多次及测试执行时间翻倍 https://www.tapd.cn/55049933/s/1615683
This commit is contained in:
parent
fa3caa483f
commit
ef258a4be2
|
@ -59,11 +59,13 @@ import org.springframework.http.MediaType;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.client.HttpServerErrorException;
|
||||
import org.springframework.web.client.ResourceAccessException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
@ -298,6 +300,11 @@ public class ApiExecuteService {
|
|||
}
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
if (e instanceof ResourceAccessException resourceAccessException
|
||||
&& resourceAccessException.getCause() instanceof SocketTimeoutException) {
|
||||
// 响应超时,则视为成功,避免任务重复发送
|
||||
break;
|
||||
}
|
||||
lastException = e;
|
||||
LogUtils.error(e);
|
||||
// 记录异常节点,重试
|
||||
|
@ -417,6 +424,12 @@ public class ApiExecuteService {
|
|||
}
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
if (e instanceof ResourceAccessException resourceAccessException
|
||||
&& resourceAccessException.getCause() instanceof SocketTimeoutException) {
|
||||
// 响应超时,则视为成功,避免任务重复发送
|
||||
success = true;
|
||||
break;
|
||||
}
|
||||
invalidNodeSet.add(testResourceNode);
|
||||
LogUtils.error("发送批量任务到 {} 节点执行失败", endpoint);
|
||||
LogUtils.error(e);
|
||||
|
|
Loading…
Reference in New Issue