Skip to content

Commit

Permalink
fix: conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin committed Oct 30, 2021
2 parents 5934f6f + 7f1521c commit 8927105
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
6 changes: 4 additions & 2 deletions cluster/router/chain/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ func NewRouterChain() (*RouterChain, error) {

for key, routerFactory := range routerFactories {
r, err := routerFactory().NewPriorityRouter()
if r == nil || err != nil {
logger.Warnf("router chain build router fail! routerFactories key:%s reason is :%v", key, err)
if err != nil {
logger.Errorf("Build router chain failed with routerFactories key:%s and error:%v", key, err)
continue
} else if r == nil {
continue
}
routers = append(routers, r)
Expand Down
7 changes: 4 additions & 3 deletions cluster/router/v3router/router_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,11 @@ func NewUniformRouterChain() (router.PriorityRouter, error) {
// 1. add mesh route listener
r := &RouterChain{}
rootConfig := config.GetRootConfig()
dynamicConfiguration, err := rootConfig.ConfigCenter.GetDynamicConfiguration()
if err != nil {
return nil, err
if rootConfig.ConfigCenter.DynamicConfiguration == nil {
logger.Infof("Config center does not start, please check if the configuration center has been properly configured in dubbogo.yml")
return nil, nil
}
dynamicConfiguration := rootConfig.ConfigCenter.DynamicConfiguration
dynamicConfiguration.AddListener(rootConfig.Application.Name, r)

// 2. try to get mesh route configuration, default key is "dubbo.io.MESHAPPRULE" with group "dubbo"
Expand Down
3 changes: 2 additions & 1 deletion config/config_center_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package config

import (
"fmt"
"net/url"
"strings"
)
Expand Down Expand Up @@ -155,7 +156,7 @@ func (c *CenterConfig) CreateDynamicConfiguration() (config_center.DynamicConfig
}
factory := extension.GetConfigCenterFactory(configCenterUrl.Protocol)
if factory == nil {
return nil, errors.New("get config center factory failed")
return nil, errors.New(fmt.Sprintf("Get config center factory of %s failed", configCenterUrl.Protocol))
}
return factory.GetDynamicConfiguration(configCenterUrl)
}
Expand Down
2 changes: 1 addition & 1 deletion config/root_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ func (rc *RootConfig) Init() error {
return err
}
if err := rc.ConfigCenter.Init(rc); err != nil {
logger.Infof("config center doesn't start, because %s", err)
logger.Infof("Config center doesn't start,because %s", err)
} else {
if err := rc.Logger.Init(); err != nil { // init logger using config from config center again
return err
Expand Down

0 comments on commit 8927105

Please sign in to comment.