mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-04 21:19:52 +08:00
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.EngineFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@ -17,13 +16,13 @@ import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
import static org.python.modules.time.Time.sleep;
|
||||
|
||||
// 非事务运行
|
||||
@Service
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public class JmeterFileService {
|
||||
@Resource
|
||||
private ExtLoadTestReportMapper extLoadTestReportMapper;
|
||||
@ -32,14 +31,14 @@ public class JmeterFileService {
|
||||
|
||||
public byte[] downloadZip(String reportId, double[] ratios, int resourceIndex) {
|
||||
try {
|
||||
LoadTestReportWithBLOBs loadTestReport = null;
|
||||
double waitingSeconds = 0;
|
||||
LoadTestReportWithBLOBs loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||
int wait = 0;
|
||||
while (loadTestReport == null) {
|
||||
if (waitingSeconds > 12000) {
|
||||
if (wait > 120_000) {
|
||||
break;
|
||||
}
|
||||
sleep(0.3);
|
||||
waitingSeconds += 0.3;
|
||||
TimeUnit.MILLISECONDS.sleep(200);
|
||||
wait += 200;
|
||||
loadTestReport = loadTestReportMapper.selectByPrimaryKey(reportId);
|
||||
}
|
||||
if (loadTestReport == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user