diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/WorkerGroupChangeNotifier.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/WorkerGroupChangeNotifier.java index 6875f115b488..8972a21549af 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/WorkerGroupChangeNotifier.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/cluster/WorkerGroupChangeNotifier.java @@ -25,6 +25,7 @@ import org.apache.commons.collections4.CollectionUtils; import java.time.Duration; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -43,7 +44,7 @@ @Component public class WorkerGroupChangeNotifier { - private static final long DEFAULT_REFRESH_WORKER_INTERVAL = Duration.ofMinutes(1).toMillis(); + private static final long DEFAULT_REFRESH_WORKER_INTERVAL = 10; private final WorkerGroupDao workerGroupDao; private final List listeners = new CopyOnWriteArrayList<>(); @@ -61,6 +62,10 @@ public WorkerGroupChangeNotifier(WorkerGroupDao workerGroupDao) { } public void subscribeWorkerGroupsChange(WorkerGroupListener listener) { + + //add all group when listener added + listener.onWorkerGroupAdd(new ArrayList<>(workerGroupMap.values())); + listeners.add(listener); }