From 48390dbd9c393d68ae7fc12a652d327e4e0e4723 Mon Sep 17 00:00:00 2001 From: guodong Date: Thu, 11 Jul 2024 15:28:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=83=E8=B7=B3=E6=A3=80=E6=B5=8B=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 直接传入service_name和group_name进行心跳检测,会频繁出现服务健康状态无刷新。使用 group_name@@service_name的标准服务名无此现象。 --- nacos/client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nacos/client.py b/nacos/client.py index 58980d8..a3922a4 100644 --- a/nacos/client.py +++ b/nacos/client.py @@ -1152,6 +1152,9 @@ def send_heartbeat(self, service_name, ip, port, cluster_name=None, weight=1.0, group_name=DEFAULT_GROUP_NAME): logger.info("[send-heartbeat] ip:%s, port:%s, service_name:%s, namespace:%s" % (ip, port, service_name, self.namespace)) + if "@@" not in service_name and group_name: + service_name = group_name + "@@" + service_name + beat_data = { "serviceName": service_name, "ip": ip, @@ -1287,4 +1290,4 @@ def stop_subscribe(self): stop subscribe timer scheduler :return: """ - self.subscribe_timer_manager.stop() \ No newline at end of file + self.subscribe_timer_manager.stop()