From 001f56b7a4f704b13efa19eee5d60e6c3763162e Mon Sep 17 00:00:00 2001 From: wangqiang32 Date: Mon, 25 Apr 2022 16:09:10 +0800 Subject: [PATCH] 'update' --- docs/nacos/nacos-discovery.md | 48 +++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/docs/nacos/nacos-discovery.md b/docs/nacos/nacos-discovery.md index 7b8f950..3e73440 100644 --- a/docs/nacos/nacos-discovery.md +++ b/docs/nacos/nacos-discovery.md @@ -437,8 +437,8 @@ public void registerService(String serviceName, String groupName, Instance insta namespaceId, serviceName, instance); String groupedServiceName = NamingUtils.getGroupedName(serviceName, groupName); if (instance.isEphemeral()) { - BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance); - beatReactor.addBeatInfo(groupedServiceName, beatInfo); + BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance); + beatReactor.addBeatInfo(groupedServiceName, beatInfo); } final Map params = new HashMap(32); @@ -660,29 +660,29 @@ public Instance getInstance(String namespaceId, String serviceName, String clust result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, switchDomain.getClientBeatInterval()); RsInfo clientBeat = null; if (StringUtils.isNotBlank(beat)) { - clientBeat = JacksonUtils.toObj(beat, RsInfo.class); + clientBeat = JacksonUtils.toObj(beat, RsInfo.class); } if (clientBeat != null) { - if (StringUtils.isNotBlank(clientBeat.getCluster())) { - clusterName = clientBeat.getCluster(); - } else { - // fix #2533 - clientBeat.setCluster(clusterName); - } - ip = clientBeat.getIp(); - port = clientBeat.getPort(); - } - - NamingUtils.checkServiceNameFormat(serviceName); - Loggers.SRV_LOG.debug("[CLIENT-BEAT] full arguments: beat: {}, serviceName: {}, namespaceId: {}", clientBeat, - serviceName, namespaceId); - BeatInfoInstanceBuilder builder = BeatInfoInstanceBuilder.newBuilder(); - int resultCode = instanceServiceV2 - .handleBeat(namespaceId, serviceName, ip, port, clusterName, clientBeat, builder); - result.put(CommonParams.CODE, resultCode); - result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, - instanceServiceV2.getHeartBeatInterval(namespaceId, serviceName, ip, port, clusterName)); - result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled()); - return result; + if (StringUtils.isNotBlank(clientBeat.getCluster())) { + clusterName = clientBeat.getCluster(); + } else { + // fix #2533 + clientBeat.setCluster(clusterName); + } + ip = clientBeat.getIp(); + port = clientBeat.getPort(); + } + + NamingUtils.checkServiceNameFormat(serviceName); + Loggers.SRV_LOG.debug("[CLIENT-BEAT] full arguments: beat: {}, serviceName: {}, namespaceId: {}", clientBeat, + serviceName, namespaceId); + BeatInfoInstanceBuilder builder = BeatInfoInstanceBuilder.newBuilder(); + int resultCode = instanceServiceV2 + .handleBeat(namespaceId, serviceName, ip, port, clusterName, clientBeat, builder); + result.put(CommonParams.CODE, resultCode); + result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, + instanceServiceV2.getHeartBeatInterval(namespaceId, serviceName, ip, port, clusterName)); + result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled()); + return result; } ```