Skip to content

Commit

Permalink
fix router rule log error
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalT committed Jul 29, 2024
1 parent ee3d011 commit 820a7e2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
8 changes: 8 additions & 0 deletions cluster/router/condition/dynamic_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ func (s *ServiceRouter) Notify(invokers []protocol.Invoker) {
logger.Errorf("Failed to query condition rule, key=%s, err=%v", key, err)
return
}
if value == "" {
logger.Infof("Condition rule is empty, key=%s", key)
return
}
s.Process(&config_center.ConfigChangeEvent{Key: key, Value: value, ConfigType: remoting.EventTypeAdd})
}

Expand Down Expand Up @@ -370,6 +374,10 @@ func (a *ApplicationRouter) Notify(invokers []protocol.Invoker) {
logger.Errorf("Failed to query condition rule, key=%s, err=%v", key, err)
return
}
if value == "" {
logger.Infof("Condition rule is empty, key=%s", key)
return
}
a.Process(&config_center.ConfigChangeEvent{Key: key, Value: value, ConfigType: remoting.EventTypeUpdate})
}
}
Expand Down
7 changes: 4 additions & 3 deletions cluster/router/condition/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ package condition

import (
"dubbo.apache.org/dubbo-go/v3/cluster/router"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
)

func init() {
// TODO(finalt) Temporarily removed until fixed
//extension.SetRouterFactory(constant.ConditionServiceRouterFactoryKey, NewServiceConditionRouterFactory)
//extension.SetRouterFactory(constant.ConditionAppRouterFactoryKey, NewAppConditionRouterFactory)
extension.SetRouterFactory(constant.ConditionServiceRouterFactoryKey, NewServiceConditionRouterFactory)
extension.SetRouterFactory(constant.ConditionAppRouterFactoryKey, NewAppConditionRouterFactory)
}

// ServiceRouteFactory router factory
Expand Down
5 changes: 3 additions & 2 deletions cluster/router/tag/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package tag

import (
"dubbo.apache.org/dubbo-go/v3/cluster/router"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/common/extension"
)

func init() {
Expand All @@ -27,8 +29,7 @@ func init() {
and cause warning if config center is empty.
User can import this package and config config center to use tag router.
*/
// TODO(finalt) Temporarily removed until fixed
//extension.SetRouterFactory(constant.TagRouterFactoryKey, NewTagRouterFactory)
extension.SetRouterFactory(constant.TagRouterFactoryKey, NewTagRouterFactory)
}

// RouteFactory router factory
Expand Down
4 changes: 4 additions & 0 deletions cluster/router/tag/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ func (p *PriorityRouter) Notify(invokers []protocol.Invoker) {
logger.Errorf("query router rule fail,key=%s,err=%v", key, err)
return
}
if value == "" {
logger.Infof("router rule is empty,key=%s", key)
return
}
p.Process(&config_center.ConfigChangeEvent{Key: key, Value: value, ConfigType: remoting.EventTypeAdd})
}

Expand Down

0 comments on commit 820a7e2

Please sign in to comment.