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


##########
cluster/router/affinity/router.go:
##########
@@ -48,6 +49,13 @@ func newServiceAffinityRoute() *ServiceAffinityRoute {
        return &ServiceAffinityRoute{}
 }
 
+func (s *ServiceAffinityRoute) SetStaticConfig(cfg *global.RouterConfig) {
+       if cfg == nil || cfg.Scope != constant.RouterScopeService {

Review Comment:
   The wrapper only filters by scope. Since the inner SetStaticConfig resets 
state before validating the key, a same-scope condition/tag config broadcast 
here would wipe an already-applied affinity rule. Better to return early like 
the condition/tag wrappers:
   ```go
   if cfg == nil || cfg.Scope != constant.RouterScopeService || 
cfg.AffinityAware.Key == "" {
       return
   }
   ```
   
   ApplicationAffinityRoute looks like the same case



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