[Fix-13828][api] Fix the problem of work groups have two defult records (#13829)

This commit is contained in:
ralphgj 2023-03-31 11:18:17 +08:00 committed by GitHub
parent 273a5e78eb
commit 8f3a23dae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -292,9 +292,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();