feat: the workflow instance whose max instance number is less than or equal to zero is always allowed to be executed

This commit is contained in:
Echo009 2021-03-03 14:26:50 +08:00
parent 21291b34cb
commit 8f9e53ed83

View File

@ -162,13 +162,15 @@ public class WorkflowInstanceManager {
log.info("[Workflow-{}|{}] workflowInstance({}) needn't running any more.", wfInfo.getId(), wfInstanceId, wfInstanceInfo);
return;
}
// 最大实例数量 <= 0 表示不限制
if (wfInfo.getMaxWfInstanceNum() > 0) {
// 并发度控制
int instanceConcurrency = workflowInstanceInfoRepository.countByWorkflowIdAndStatusIn(wfInfo.getId(), WorkflowInstanceStatus.GENERALIZED_RUNNING_STATUS);
if (instanceConcurrency > wfInfo.getMaxWfInstanceNum()) {
if ( instanceConcurrency > wfInfo.getMaxWfInstanceNum()) {
onWorkflowInstanceFailed(String.format(SystemInstanceResult.TOO_MANY_INSTANCES, instanceConcurrency, wfInfo.getMaxWfInstanceNum()), wfInstanceInfo);
return;
}
}
try {
// 从实例中读取工作流信息