liubao68 commented on code in PR #4670:
URL:
https://github.com/apache/servicecomb-java-chassis/pull/4670#discussion_r1908757960
##########
service-registry/registry-nacos/src/main/java/org/apache/servicecomb/registry/nacos/NacosRegistration.java:
##########
@@ -132,9 +132,20 @@ 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.DOWN == status) {
+ instance.getMetadata().put(NacosConst.NACOS_STATUS,
MicroserviceInstanceStatus.DOWN.name());
+
namingService.deregisterInstance(nacosRegistrationInstance.getServiceName(),
+ nacosRegistrationInstance.getApplication(), instance);
+ } else {
+ instance.getMetadata().put(NacosConst.NACOS_STATUS, status.name());
+
namingService.registerInstance(nacosRegistrationInstance.getServiceName(),
+ nacosRegistrationInstance.getApplication(), instance);
+ }
+ return true;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
Review Comment:
Whatever status, update. No need to check status. Will `registerInstance`
cause two instances? If Nacos do not support update status, maybe we can not
use this feature for nacos.
--
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]