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


##########
cluster/router/tag/router.go:
##########
@@ -52,6 +55,19 @@ func (p *PriorityRouter) Route(invokers []base.Invoker, url 
*common.URL, invocat
                logger.Warn("[Router][Tag] invokers from previous router is 
empty")
                return invokers
        }
+
+       // Cache only takes effect when TagRouter is the first router in the 
chain.
+       // RouterChain sets RouterCacheDisable=true after each router, so later 
routers always skip cache.
+       if v := p.cache.Load(); v != nil {
+               if 
!invocation.GetAttributeWithDefaultValue(constant.RouterCacheDisable, 
false).(bool) {
+                       c := v.(router.Cache)
+                       pool, fullInvokers := c.FindAddrPool(p)
+                       if pool != nil && fullInvokers != nil {
+                               return p.routeWithPool(fullInvokers, pool, url, 
invocation)
+                       }
+               }
+       }

Review Comment:
   已修复,引入了 generation 字段来标识目前的 invoker 的版本,invoker 变化的时候 generation 递增。route 
的时候比较 generation 如果不相等就 fallback



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