Skip to content

Commit

Permalink
fix issue nacos-group#327
Browse files Browse the repository at this point in the history
  • Loading branch information
qinwenlong committed Jun 21, 2023
1 parent a1d683a commit 08ecdaa
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ public boolean sync(TaskDO taskDO, Integer index) {

private void cleanAllOldInstance(TaskDO taskDO, NamingService destNamingService, Set<String> instanceKeys)
throws NacosException {
List<Instance> allInstances = destNamingService.getAllInstances(taskDO.getServiceName());
String groupName = NacosUtils.getGroupNameOrDefault(taskDO.getGroupName());
List<Instance> 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());
}
}
}
Expand Down

0 comments on commit 08ecdaa

Please sign in to comment.