mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-11-30 11:08:38 +08:00
refactor(性能测试): 避免重复添加 backend listener
--bug=1011512 --user=刘瑞斌 【性能测试】有一个性能测试一直在running,应是已经跑完了 https://www.tapd.cn/55049933/s/1124218
This commit is contained in:
parent
278c46a629
commit
3bbe2f428f
@ -16,6 +16,7 @@ public class EngineContext {
|
||||
private Map<String, Object> properties = new HashMap<>();
|
||||
private Map<String, byte[]> testResourceFiles = new HashMap<>();
|
||||
private Map<String, Boolean> splitFlag = new HashMap<>();
|
||||
private boolean checkBackendListener;
|
||||
|
||||
public String getTestId() {
|
||||
return testId;
|
||||
@ -117,4 +118,12 @@ public class EngineContext {
|
||||
public void setSplitFlag(Map<String, Boolean> splitFlag) {
|
||||
this.splitFlag = splitFlag;
|
||||
}
|
||||
|
||||
public boolean isCheckBackendListener() {
|
||||
return checkBackendListener;
|
||||
}
|
||||
|
||||
public void setCheckBackendListener(boolean checkBackendListener) {
|
||||
this.checkBackendListener = checkBackendListener;
|
||||
}
|
||||
}
|
||||
|
@ -612,6 +612,10 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
if (checkLicense() && !BooleanUtils.toBoolean(resourcePool.getBackendListener())) {
|
||||
return;
|
||||
}
|
||||
// 已经添加过不再重复添加
|
||||
if (context.isCheckBackendListener()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Element listenerParent = getNextSibling(element);
|
||||
|
||||
@ -632,6 +636,8 @@ public class JmeterDocumentParser implements EngineSourceParser {
|
||||
backendListener.addAttribute("enabled", "true");
|
||||
|
||||
listenerParent.addElement(HASH_TREE_ELEMENT);
|
||||
// 标记已经添加上
|
||||
context.setCheckBackendListener(true);
|
||||
}
|
||||
|
||||
private boolean checkLicense() {
|
||||
|
Loading…
Reference in New Issue
Block a user