Skip to content

Commit 42878a2

Browse files
authored
dashboard: Fix the bug that removing token servers may fail when there are servers with the same IP (#2591)
1 parent 0cd0629 commit 42878a2

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

sentinel-dashboard/src/main/java/com/alibaba/csp/sentinel/dashboard/util/ClusterEntityUtils.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,8 @@ public static List<ClusterGroupEntity> wrapToClusterGroup(List<ClusterUniversalS
130130
if (mode == ClusterStateManager.CLUSTER_SERVER) {
131131
String serverAddress = getIp(ip);
132132
int port = stateVO.getState().getServer().getPort();
133-
map.computeIfAbsent(serverAddress, v -> new ClusterGroupEntity()
133+
String targetAddress = serverAddress + ":" + port;
134+
map.computeIfAbsent(targetAddress, v -> new ClusterGroupEntity()
134135
.setBelongToApp(true).setMachineId(ip + '@' + stateVO.getCommandPort())
135136
.setIp(ip).setPort(port)
136137
);
@@ -145,8 +146,8 @@ public static List<ClusterGroupEntity> wrapToClusterGroup(List<ClusterUniversalS
145146
if (StringUtil.isBlank(targetServer) || targetPort == null || targetPort <= 0) {
146147
continue;
147148
}
148-
149-
ClusterGroupEntity group = map.computeIfAbsent(targetServer,
149+
String targetAddress = targetServer + ":" + targetPort;
150+
ClusterGroupEntity group = map.computeIfAbsent(targetAddress,
150151
v -> new ClusterGroupEntity()
151152
.setBelongToApp(true).setMachineId(targetServer)
152153
.setIp(targetServer).setPort(targetPort)

0 commit comments

Comments
 (0)