This commit is contained in:
JohnHuang 2024-06-11 23:10:07 -07:00 committed by GitHub
commit 7ef3b203d6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -85,6 +85,12 @@ public class WorkflowExecuteThreadPool extends ThreadPoolTaskExecutor {
if (!workflowExecuteThread.isStart() || workflowExecuteThread.eventSize() == 0) {
return;
}
if (isOverload()) {
log.warn("WorkflowExecuteThreadPool is overload, cannot submit new workflowExecuteThread");
return;
}
IWorkflowExecuteContext workflowExecuteRunnableContext =
workflowExecuteThread.getWorkflowExecuteContext();
Integer workflowInstanceId = workflowExecuteRunnableContext.getWorkflowInstance().getId();
@ -131,4 +137,7 @@ public class WorkflowExecuteThreadPool extends ThreadPoolTaskExecutor {
});
}
public boolean isOverload() {
return this.getThreadPoolExecutor().getQueue().size() >= masterConfig.getExecThreads();
}
}