ralphgj commented on code in PR #13829:
URL:
https://github.com/apache/dolphinscheduler/pull/13829#discussion_r1153059504
##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/WorkerGroupServiceImpl.java:
##########
@@ -293,7 +293,9 @@ private List<WorkerGroup> getWorkerGroups(List<Integer>
ids) {
workerGroups = workerGroupMapper.queryAllWorkerGroup();
}
Optional<Boolean> containDefaultWorkerGroups = workerGroups.stream()
- .map(workerGroup ->
Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName())).findAny();
+ .map(workerGroup ->
Constants.DEFAULT_WORKER_GROUP.equals(workerGroup.getName()))
+ .filter(result -> result)
Review Comment:
The "containDefaultWorkerGroups" method should verify whether it contains
the `default` work group. The "map" method only converts the work group into
true/false, which indicates whether it is the `default` work group or not. The
"findAny" method will select the first one. If the first work group converted
by "map" is not the default work group, the result of
"containDefaultWorkerGroups" will be false, but the actual work group retrieved
contains the default work group.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]