Fix beat info null bug
This commit is contained in:
parent
1aa7711340
commit
7c0e12d6fe
@ -238,7 +238,9 @@ public class NacosNamingService implements NamingService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deregisterInstance(String serviceName, String groupName, Instance instance) throws NacosException {
|
public void deregisterInstance(String serviceName, String groupName, Instance instance) throws NacosException {
|
||||||
beatReactor.removeBeatInfo(NamingUtils.getGroupedName(serviceName, groupName), instance.getIp(), instance.getPort());
|
if (instance.isEphemeral()) {
|
||||||
|
beatReactor.removeBeatInfo(NamingUtils.getGroupedName(serviceName, groupName), instance.getIp(), instance.getPort());
|
||||||
|
}
|
||||||
serverProxy.deregisterService(NamingUtils.getGroupedName(serviceName, groupName), instance);
|
serverProxy.deregisterService(NamingUtils.getGroupedName(serviceName, groupName), instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,6 +64,9 @@ public class BeatReactor {
|
|||||||
public void removeBeatInfo(String serviceName, String ip, int port) {
|
public void removeBeatInfo(String serviceName, String ip, int port) {
|
||||||
NAMING_LOGGER.info("[BEAT] removing beat: {}:{}:{} from beat map.", serviceName, ip, port);
|
NAMING_LOGGER.info("[BEAT] removing beat: {}:{}:{} from beat map.", serviceName, ip, port);
|
||||||
BeatInfo beatInfo = dom2Beat.remove(buildKey(serviceName, ip, port));
|
BeatInfo beatInfo = dom2Beat.remove(buildKey(serviceName, ip, port));
|
||||||
|
if (beatInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
beatInfo.setStopped(true);
|
beatInfo.setStopped(true);
|
||||||
MetricsMonitor.getDom2BeatSizeMonitor().set(dom2Beat.size());
|
MetricsMonitor.getDom2BeatSizeMonitor().set(dom2Beat.size());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user