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 2022/06/11 05:20:43 UTC

[GitHub] [dubbo-go-pixiu] ztelur commented on a diff in pull request #440: Fix/nacos cluster

ztelur commented on code in PR #440:
URL: https://github.com/apache/dubbo-go-pixiu/pull/440#discussion_r894979014


##########
pkg/common/util/stringutil/stringutil.go:
##########
@@ -18,6 +18,8 @@
 package stringutil
 
 import (
+	perrors "github.com/pkg/errors"

Review Comment:
   use ` imports-formatter -path . -module github.com/apache/dubbo-go-pixiu -bl false` to auto group imports line



##########
pkg/router/route.go:
##########
@@ -58,12 +59,54 @@ func (rt *Route) ClearAPI() error {
 	return nil
 }
 
-func (r *Route) RemoveAPI(api router.API) {
-	r.lock.Lock()
-	defer r.lock.Unlock()
+func (rt *Route) RemoveAPI(api router.API) {
 	lowerCasePath := strings.ToLower(api.URLPattern)
 	key := getTrieKey(api.Method.HTTPVerb, lowerCasePath, false)
-	_, _ = r.tree.Remove(key)
+
+	rt.lock.Lock()
+	defer rt.lock.Unlock()
+	// if api is exists
+	if exists, err := rt.tree.Contains(key); err != nil {
+		logger.Errorf("rt.tree.Get(key) err: %s", err.Error())
+		return
+	} else if exists {
+		// append new cluster to the node

Review Comment:
   这部分代码修改的背景或者目的是?



-- 
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: notifications-unsubscribe@dubbo.apache.org

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