Alanxtl commented on code in PR #3420:
URL: https://github.com/apache/dubbo-go/pull/3420#discussion_r3433124509


##########
cluster/router/affinity/router.go:
##########


Review Comment:
   静态 affinity 配置会被空动态规则清掉
     
   在 /cluster/router/affinity/router.go:78 和 
/cluster/router/affinity/router.go:150 ,`Notify()` 拿到 `GetRule(key)` 
后不判断空字符串,直接调用 `Process()`;而 /cluster/router/affinity/router.go:217 一进来就把 
`a.staticRules = nil`。这样用户配置了静态 affinity router,同时启用了 config center、但 config 
center 里没有对应动态 affinity 规则时,初始化注入的静态规则会立刻被空动态规则覆盖掉,静态配置实际不生效。这个场景很常见,而且 
`condition` / `tag` router 都有 `value == ""` 的保护,不会清掉静态 bootstrap 规则。建议 affinity 
的 service/application `Notify()` 也在 `value == ""` 时直接 return,或者让 `Process()` 对空 
value 不重置当前规则。
   



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