From 4f21a416050093c4b90de08f419769eb459aaf7b Mon Sep 17 00:00:00 2001 From: finalt Date: Mon, 8 Jan 2024 10:16:29 +0800 Subject: [PATCH] merge #2559 into main branch (#2568) --- cluster/router/condition/dynamic_router.go | 15 ++++++++------- cluster/router/tag/router.go | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cluster/router/condition/dynamic_router.go b/cluster/router/condition/dynamic_router.go index c02d0a09de..90245b910c 100644 --- a/cluster/router/condition/dynamic_router.go +++ b/cluster/router/condition/dynamic_router.go @@ -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}, "") @@ -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.") @@ -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) } diff --git a/cluster/router/tag/router.go b/cluster/router/tag/router.go index 3475d7f180..efe77aedd1 100644 --- a/cluster/router/tag/router.go +++ b/cluster/router/tag/router.go @@ -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}, "")