diff --git a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/ConsulSyncToNacosServiceImpl.java b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/ConsulSyncToNacosServiceImpl.java index 1f8e3b59..89cbbd9d 100644 --- a/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/ConsulSyncToNacosServiceImpl.java +++ b/nacossync-worker/src/main/java/com/alibaba/nacossync/extension/impl/ConsulSyncToNacosServiceImpl.java @@ -117,13 +117,14 @@ public boolean sync(TaskDO taskDO, Integer index) { private void cleanAllOldInstance(TaskDO taskDO, NamingService destNamingService, Set instanceKeys) throws NacosException { - List allInstances = destNamingService.getAllInstances(taskDO.getServiceName()); + String groupName = NacosUtils.getGroupNameOrDefault(taskDO.getGroupName()); + List allInstances = destNamingService.getAllInstances(taskDO.getServiceName(), groupName); for (Instance instance : allInstances) { if (needDelete(instance.getMetadata(), taskDO) && !instanceKeys.contains(composeInstanceKey(instance.getIp(), instance.getPort()))) { destNamingService.deregisterInstance(taskDO.getServiceName(), - NacosUtils.getGroupNameOrDefault(taskDO.getGroupName()), instance.getIp(), instance.getPort()); + groupName, instance.getIp(), instance.getPort()); } } }