diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/TaskDispatcher.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/TaskDispatcher.java index 727932dcd..ea6471e1d 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/TaskDispatcher.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/TaskDispatcher.java @@ -107,14 +107,16 @@ public class TaskDispatcher { continue; } + if (StringUtils.isBlank(key)) { + continue; + } + if (dataSize == 0) { keys = new ArrayList<>(); } - if (StringUtils.isNotBlank(key)) { - keys.add(key); - dataSize++; - } + keys.add(key); + dataSize++; if (dataSize == partitionConfig.getBatchSyncKeyCount() || (System.currentTimeMillis() - lastDispatchTime) > partitionConfig.getTaskDispatchPeriod()) {