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


##########
cluster/router/chain/chain.go:
##########
@@ -66,10 +67,13 @@ func (c *RouterChain) Route(url *common.URL, invocation 
base.Invocation) []base.
 
        if len(finalInvokers) == 0 {
                finalInvokers = invokers
+       } else if len(finalInvokers) != len(invokers) {
+               invocation.SetAttribute(constant.RouterCacheDisable, true)
        }

Review Comment:
   `RouterCacheDisable` 在 `len(finalInvokers) != len(invokers)` 和 任意路由器 Route 
后都会设置
   ```go
   if len(finalInvokers) == 0 {
        finalInvokers = invokers
   } else if len(finalInvokers) != len(invokers) {
        invocation.SetAttribute(constant.RouterCacheDisable, true)
   }
   
   for _, r := range c.copyRouters() {
        finalInvokers = r.Route(finalInvokers, url, invocation)
        invocation.SetAttribute(constant.RouterCacheDisable, true)
   }
   ```
   
   `len(finalInvokers) != len(invokers)`  时设置 `RouterCacheDisable` 是为了防止 
invoker 被按 ServiceKey() 过滤,而非对前置路由器过滤的简单检查
   



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