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: [email protected]

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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to