Aetherance commented on code in PR #3252:
URL: https://github.com/apache/dubbo-go/pull/3252#discussion_r3010065303


##########
cluster/router/chain/chain.go:
##########
@@ -110,6 +111,83 @@ func (c *RouterChain) copyRouters() 
[]router.PriorityRouter {
        return ret
 }
 
+// getApplicationName gets the application name from URL with fallback to 
SubURL
+func getApplicationName(url *common.URL) string {
+       appName := url.GetParam(constant.ApplicationKey, "")
+       if appName == "" && url.SubURL != nil {
+               appName = url.SubURL.GetParam(constant.ApplicationKey, "")
+       }
+       return appName
+}
+
+// isRouterMatch checks if router configuration matches the current 
service/application
+func isRouterMatch(routerCfg *global.RouterConfig, url *common.URL, appName 
string) bool {
+       switch routerCfg.Scope {
+       case constant.RouterScopeService:
+               if url.SubURL != nil {
+                       return routerCfg.Key == url.SubURL.ServiceKey()
+               }
+               return routerCfg.Key == url.ServiceKey()
+       case constant.RouterScopeApplication:

Review Comment:
   这里不应该再加一层错误使用了 consumer url 的 isRouterMatch(下层已实现按 scope 分配 router config 
相关逻辑)  已删除该错误逻辑
   
   而对于 tag router 来说 router config 查找和 存储 key 的语义是一致的,都是 provider 
application,存储时使用的 provider application 是由router config 中的 key 字段提供的



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