fix(性能测试): 修复性能测试多节点执行是页面卡在starting的问题
--bug=1008998 --user=刘瑞斌 【性能测试】多个node执行性能测试失败 https://www.tapd.cn/55049933/s/1083328
This commit is contained in:
parent
572412e2cf
commit
9dd9620dac
|
@ -9,7 +9,6 @@ import io.metersphere.commons.utils.LogUtil;
|
||||||
import io.metersphere.performance.engine.EngineContext;
|
import io.metersphere.performance.engine.EngineContext;
|
||||||
import io.metersphere.performance.engine.EngineFactory;
|
import io.metersphere.performance.engine.EngineFactory;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -17,13 +16,13 @@ import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
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)
|
|
||||||
public class JmeterFileService {
|
public class JmeterFileService {
|
||||||
@Resource
|
@Resource
|
||||||
private ExtLoadTestReportMapper extLoadTestReportMapper;
|
private ExtLoadTestReportMapper extLoadTestReportMapper;
|
||||||
|
@ -32,14 +31,14 @@ 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 = null;
|
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
double waitingSeconds = 0;
|
int wait = 0;
|
||||||
while (loadTestReport == null) {
|
while (loadTestReport == null) {
|
||||||
if (waitingSeconds > 12000) {
|
if (wait > 120_000) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
sleep(0.3);
|
TimeUnit.MILLISECONDS.sleep(200);
|
||||||
waitingSeconds += 0.3;
|
wait += 200;
|
||||||
loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||||
}
|
}
|
||||||
if (loadTestReport == null) {
|
if (loadTestReport == null) {
|
||||||
|
|
Loading…
Reference in New Issue