fix(接口测试): 并发数设置校验
--bug=1011287 --user=赵勇 【系统设置】—基本配置 并发用户数设置10000 报错 https://www.tapd.cn/55049933/s/1120137
This commit is contained in:
parent
10b3b8500d
commit
9f76f55d2d
|
@ -102,10 +102,13 @@ public class ExecThreadPoolExecutor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCorePoolSize(int corePoolSize) {
|
public void setCorePoolSize(int maximumPoolSize) {
|
||||||
try {
|
try {
|
||||||
threadPool.setCorePoolSize(corePoolSize);
|
int corePoolSize = maximumPoolSize > 1000 ? 1000 : maximumPoolSize;
|
||||||
threadPool.setMaximumPoolSize(corePoolSize);
|
if (corePoolSize > CORE_POOL_SIZE) {
|
||||||
|
threadPool.setCorePoolSize(corePoolSize);
|
||||||
|
}
|
||||||
|
threadPool.setMaximumPoolSize(maximumPoolSize);
|
||||||
threadPool.allowCoreThreadTimeOut(true);
|
threadPool.allowCoreThreadTimeOut(true);
|
||||||
LoggerUtil.info("AllCoreThreads: " + threadPool.prestartAllCoreThreads());
|
LoggerUtil.info("AllCoreThreads: " + threadPool.prestartAllCoreThreads());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -267,8 +267,15 @@ public class SystemParameterService {
|
||||||
parameters.forEach(param -> {
|
parameters.forEach(param -> {
|
||||||
if (param.getParamKey().equals("base.concurrency")) {
|
if (param.getParamKey().equals("base.concurrency")) {
|
||||||
if (StringUtils.isNotEmpty(param.getParamValue())) {
|
if (StringUtils.isNotEmpty(param.getParamValue())) {
|
||||||
int poolSize = Integer.parseInt(param.getParamValue());
|
try {
|
||||||
CommonBeanFactory.getBean(ExecThreadPoolExecutor.class).setCorePoolSize(poolSize);
|
int poolSize = Integer.parseInt(param.getParamValue());
|
||||||
|
if (poolSize > 10000) {
|
||||||
|
MSException.throwException("并发数设置太大,请重新设置");
|
||||||
|
}
|
||||||
|
CommonBeanFactory.getBean(ExecThreadPoolExecutor.class).setCorePoolSize(poolSize);
|
||||||
|
} catch (Exception e) {
|
||||||
|
MSException.throwException("并发数设置不规范,请重新设置");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 去掉路径最后的 /
|
// 去掉路径最后的 /
|
||||||
|
|
|
@ -106,6 +106,8 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(this.$t('commons.save_failed'));
|
this.$message.error(this.$t('commons.save_failed'));
|
||||||
}
|
}
|
||||||
|
}, error => {
|
||||||
|
this.edit();
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -125,8 +127,8 @@ export default {
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
||||||
.el-form {
|
.el-form {
|
||||||
min-height: 300px;
|
min-height: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue