Skip to content

Commit

Permalink
merge #2559 into main branch (#2568)
Browse files Browse the repository at this point in the history
  • Loading branch information
FinalT committed Jan 8, 2024
1 parent 7341d50 commit 4f21a41
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions cluster/router/condition/dynamic_router.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func (s *ServiceRouter) Notify(invokers []protocol.Invoker) {

dynamicConfiguration := conf.GetEnvInstance().GetDynamicConfiguration()
if dynamicConfiguration == nil {
logger.Warnf("config center does not start, please check if the configuration center has been properly configured in dubbogo.yml")
logger.Infof("Config center does not start, Condition router will not be enabled")
return
}
key := strings.Join([]string{url.ColonSeparatedKey(), constant.ConditionRouterRuleSuffix}, "")
Expand Down Expand Up @@ -171,6 +171,13 @@ func (a *ApplicationRouter) Notify(invokers []protocol.Invoker) {
logger.Error("Failed to notify a dynamically condition rule, because url is empty")
return
}

dynamicConfiguration := conf.GetEnvInstance().GetDynamicConfiguration()
if dynamicConfiguration == nil {
logger.Infof("Config center does not start, Condition router will not be enabled")
return
}

providerApplicaton := url.GetParam("application", "")
if providerApplicaton == "" || providerApplicaton == a.currentApplication {
logger.Warn("condition router get providerApplication is empty, will not subscribe to provider app rules.")
Expand All @@ -181,12 +188,6 @@ func (a *ApplicationRouter) Notify(invokers []protocol.Invoker) {
defer a.mu.Unlock()

if providerApplicaton != a.application {
dynamicConfiguration := conf.GetEnvInstance().GetDynamicConfiguration()
if dynamicConfiguration == nil {
logger.Warnf("config center does not start, please check if the configuration center has been properly configured in dubbogo.yml")
return
}

if a.application != "" {
dynamicConfiguration.RemoveListener(strings.Join([]string{a.application, constant.ConditionRouterRuleSuffix}, ""), a)
}
Expand Down
2 changes: 1 addition & 1 deletion cluster/router/tag/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (p *PriorityRouter) Notify(invokers []protocol.Invoker) {
}
dynamicConfiguration := conf.GetEnvInstance().GetDynamicConfiguration()
if dynamicConfiguration == nil {
logger.Warnf("config center does not start, please check if the configuration center has been properly configured in dubbogo.yml")
logger.Infof("Config center does not start, Tag router will not be enabled")
return
}
key := strings.Join([]string{application, constant.TagRouterRuleSuffix}, "")
Expand Down

0 comments on commit 4f21a41

Please sign in to comment.