fix(接口测试): 并发数设置校验
--bug=1011287 --user=赵勇 【系统设置】—基本配置 并发用户数设置10000 报错 https://www.tapd.cn/55049933/s/1120137
This commit is contained in:
parent
5534fd9253
commit
e09bbcb8fc
|
@ -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) {
|
||||
|
|
|
@ -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("并发数设置不规范,请重新设置");
|
||||
}
|
||||
}
|
||||
}
|
||||
// 去掉路径最后的 /
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue