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/08/01 03:41:41 UTC

[GitHub] [dubbo-go] Mulavar commented on a diff in pull request #2000: Fix: route with more invokers

Mulavar commented on code in PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#discussion_r934114815


##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&
+			invokerURL.Group() == url.Group() &&
+			invokerURL.Interface() == strings.Trim(url.Path, "/") {

Review Comment:
   replace / with constant



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