修复了压测中因为网络原因导致的jmx下载失败的bug
This commit is contained in:
parent
7f0de8ca96
commit
beafdc1b31
|
@ -20,6 +20,8 @@ import java.util.Map;
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import static org.python.modules.time.Time.sleep;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public class JmeterFileService {
|
public class JmeterFileService {
|
||||||
|
@ -30,7 +32,16 @@ public class JmeterFileService {
|
||||||
|
|
||||||
public byte[] downloadZip(String reportId, double[] ratios, int resourceIndex) {
|
public byte[] downloadZip(String reportId, double[] ratios, int resourceIndex) {
|
||||||
try {
|
try {
|
||||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
LoadTestReportWithBLOBs loadTestReport = null;
|
||||||
|
double waitingSeconds = 0;
|
||||||
|
while (loadTestReport == null) {
|
||||||
|
if (waitingSeconds > 12000) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sleep(0.3);
|
||||||
|
waitingSeconds += 0.3;
|
||||||
|
loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
|
}
|
||||||
if (loadTestReport == null) {
|
if (loadTestReport == null) {
|
||||||
MSException.throwException("测试报告不存在或还没产生");
|
MSException.throwException("测试报告不存在或还没产生");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue