chenshouye168 commented on code in PR #4670:
URL: 
https://github.com/apache/servicecomb-java-chassis/pull/4670#discussion_r1908587249


##########
service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java:
##########
@@ -132,9 +132,21 @@ public NacosRegistrationInstance getMicroserviceInstance() 
{
 
   @Override
   public boolean updateMicroserviceInstanceStatus(MicroserviceInstanceStatus 
status) {
-    // Do not support Nacos update status now. Because update status will fail
-    // due to some unknown reasons(Maybe different constrains in register and 
maintain api).
-    return true;
+    try {
+      if (MicroserviceInstanceStatus.UP == status){
+        instance.getMetadata().put(NacosConst.NACOS_STATUS, 
MicroserviceInstanceStatus.UP.name());
+        
namingService.registerInstance(nacosRegistrationInstance.getServiceName(),
+                nacosRegistrationInstance.getApplication(), instance);
+      }
+      if (MicroserviceInstanceStatus.DOWN == status){
+        instance.getMetadata().put(NacosConst.NACOS_STATUS, 
MicroserviceInstanceStatus.DOWN.name());
+        
namingService.deregisterInstance(nacosRegistrationInstance.getServiceName(),
+                nacosRegistrationInstance.getApplication(), instance);
+      }
+      return true;
+    } catch (Exception e) {
+      throw new RuntimeException(e);
+    }

Review Comment:
   ok, Instance status equal  DOWN  to exec 'deregisterInstance()' method,  the 
other  exec 'registerInstance()'



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to