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 {
|
||||
int corePoolSize = maximumPoolSize > 1000 ? 1000 : maximumPoolSize;
|
||||
if (corePoolSize > CORE_POOL_SIZE) {
|
||||
threadPool.setCorePoolSize(corePoolSize);
|
||||
threadPool.setMaximumPoolSize(corePoolSize);
|
||||
}
|
||||
threadPool.setMaximumPoolSize(maximumPoolSize);
|
||||
threadPool.allowCoreThreadTimeOut(true);
|
||||
LoggerUtil.info("AllCoreThreads: " + threadPool.prestartAllCoreThreads());
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -267,8 +267,15 @@ public class SystemParameterService {
|
|||
parameters.forEach(param -> {
|
||||
if (param.getParamKey().equals("base.concurrency")) {
|
||||
if (StringUtils.isNotEmpty(param.getParamValue())) {
|
||||
try {
|
||||
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 {
|
||||
this.$message.error(this.$t('commons.save_failed'));
|
||||
}
|
||||
}, error => {
|
||||
this.edit();
|
||||
});
|
||||
} else {
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue