Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:merge #2559 into main branch #2568

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading