fix(接口测试): 并发数设置校验

--bug=1011287 --user=赵勇 【系统设置】—基本配置 并发用户数设置10000 报错 https://www.tapd.cn/55049933/s/1120137
This commit is contained in:
fit2-zhao 2022-03-17 15:23:41 +08:00 committed by fit2-zhao
parent 10b3b8500d
commit 9f76f55d2d
3 changed files with 20 additions and 8 deletions

View File

@ -102,10 +102,13 @@ public class ExecThreadPoolExecutor {
}
}
public void setCorePoolSize(int corePoolSize) {
public void setCorePoolSize(int maximumPoolSize) {
try {
threadPool.setCorePoolSize(corePoolSize);
threadPool.setMaximumPoolSize(corePoolSize);
int corePoolSize = maximumPoolSize > 1000 ? 1000 : maximumPoolSize;
if (corePoolSize > CORE_POOL_SIZE) {
threadPool.setCorePoolSize(corePoolSize);
}
threadPool.setMaximumPoolSize(maximumPoolSize);
threadPool.allowCoreThreadTimeOut(true);
LoggerUtil.info("AllCoreThreads: " + threadPool.prestartAllCoreThreads());
} catch (Exception e) {

View File

@ -267,8 +267,15 @@ public class SystemParameterService {
parameters.forEach(param -> {
if (param.getParamKey().equals("base.concurrency")) {
if (StringUtils.isNotEmpty(param.getParamValue())) {
int poolSize = Integer.parseInt(param.getParamValue());
CommonBeanFactory.getBean(ExecThreadPoolExecutor.class).setCorePoolSize(poolSize);
try {
int poolSize = Integer.parseInt(param.getParamValue());
if (poolSize > 10000) {
MSException.throwException("并发数设置太大,请重新设置");
}
CommonBeanFactory.getBean(ExecThreadPoolExecutor.class).setCorePoolSize(poolSize);
} catch (Exception e) {
MSException.throwException("并发数设置不规范,请重新设置");
}
}
}
// 去掉路径最后的 /

View File

@ -106,6 +106,8 @@ export default {
} else {
this.$message.error(this.$t('commons.save_failed'));
}
}, error => {
this.edit();
});
} else {
return false;
@ -125,8 +127,8 @@ export default {
<style scoped>
.el-form {
min-height: 300px;
}
.el-form {
min-height: 300px;
}
</style>