This is an automated email from the ASF dual-hosted git repository.

kerwin pushed a commit to branch 3.1.6-prepare
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/3.1.6-prepare by this push:
     new 7e134b24ef cherry-pick [Fix-13828][api] Fix the problem of work groups 
have two defult records #13829
7e134b24ef is described below

commit 7e134b24ef56bd87ce9639349c3e38d99b0a0ac8
Author: ralphgj <[email protected]>
AuthorDate: Fri Mar 31 11:18:17 2023 +0800

    cherry-pick [Fix-13828][api] Fix the problem of work groups have two defult 
records #13829
---
 .../dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java  | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
index 285c5e82eb..5a08f23e2c 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java
@@ -279,10 +279,9 @@ public class WorkerGroupServiceImpl extends 
BaseServiceImpl implements WorkerGro
         } else {
             workerGroups = workerGroupMapper.queryAllWorkerGroup();
         }
-
-        Optional<Boolean> containDefaultWorkerGroups = workerGroups.stream()
-                .map(workerGroup -> 
Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName())).findAny();
-        if (!containDefaultWorkerGroups.isPresent() || 
!containDefaultWorkerGroups.get()) {
+        boolean containDefaultWorkerGroups = workerGroups.stream()
+                .anyMatch(workerGroup -> 
Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName()));
+        if (!containDefaultWorkerGroups) {
             // there doesn't exist a default WorkerGroup, we will add all 
worker to the default worker group.
             Set<String> activeWorkerNodes = 
registryClient.getServerNodeSet(NodeType.WORKER);
             WorkerGroup defaultWorkerGroup = new WorkerGroup();

Reply via email to