You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2020/07/21 02:07:41 UTC

[GitHub] [dubbo-go] lzp0412 opened a new pull request #668: fix not inovke nacos destroy when graceful shutdown

lzp0412 opened a new pull request #668:
URL: https://github.com/apache/dubbo-go/pull/668


   fix not inovke nacos destroy when graceful shutdown


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] gaoxinge commented on a change in pull request #668: fix not inovke nacos destroy when graceful shutdown

Posted by GitBox <gi...@apache.org>.
gaoxinge commented on a change in pull request #668:
URL: https://github.com/apache/dubbo-go/pull/668#discussion_r460385664



##########
File path: registry/nacos/registry.go
##########
@@ -176,6 +178,21 @@ func createRegisterParam(url common.URL, serviceName string) vo.RegisterInstance
 	return instance
 }
 
+func createDegisterParam(url common.URL, serviceName string) vo.DeregisterInstanceParam {

Review comment:
       It may be better that change `createDegisterParam` to `createDeregisterParam`.

##########
File path: registry/nacos/registry.go
##########
@@ -186,6 +203,20 @@ func (nr *nacosRegistry) Register(url common.URL) error {
 	if !isRegistry {
 		return perrors.New("registry [" + serviceName + "] to  nacos failed")
 	}
+	nr.registryUrls = append(nr.registryUrls, url)
+	return nil
+}
+
+func (nr *nacosRegistry) DeRegister(url common.URL) error {
+	serviceName := getServiceName(url)
+	param := createDegisterParam(url, serviceName)
+	isDeRegistry, err := nr.namingClient.DeregisterInstance(param)
+	if err != nil {
+		return err
+	}
+	if !isDeRegistry {
+		return perrors.New("DeRegistry [" + serviceName + "] to  nacos failed")

Review comment:
       Two spaces in `to  nacos`.

##########
File path: registry/nacos/registry.go
##########
@@ -236,5 +267,12 @@ func (nr *nacosRegistry) IsAvailable() bool {
 }
 
 func (nr *nacosRegistry) Destroy() {
+	for _, url := range nr.registryUrls {
+		err := nr.DeRegister(url)
+		logger.Infof("DeRegister Nacos url:%+v", url)
+		if err != nil {
+			logger.Errorf("Deregister url:%+v  err:%v", url, err.Error())

Review comment:
       Two spaces in `url:%+v  err:%v`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] fangyincheng merged pull request #668: fix not inovke nacos destroy when graceful shutdown

Posted by GitBox <gi...@apache.org>.
fangyincheng merged pull request #668:
URL: https://github.com/apache/dubbo-go/pull/668


   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


[GitHub] [dubbo-go] gaoxinge commented on a change in pull request #668: fix not inovke nacos destroy when graceful shutdown

Posted by GitBox <gi...@apache.org>.
gaoxinge commented on a change in pull request #668:
URL: https://github.com/apache/dubbo-go/pull/668#discussion_r460385664



##########
File path: registry/nacos/registry.go
##########
@@ -176,6 +178,21 @@ func createRegisterParam(url common.URL, serviceName string) vo.RegisterInstance
 	return instance
 }
 
+func createDegisterParam(url common.URL, serviceName string) vo.DeregisterInstanceParam {

Review comment:
       It may be better that rename `createDegisterParam` to `createDeregisterParam`.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org