nanjiek commented on code in PR #3232:
URL: https://github.com/apache/dubbo-go/pull/3232#discussion_r2936321308
##########
client/options.go:
##########
@@ -585,35 +547,24 @@ func (cliOpts *ClientOptions) init(opts ...ClientOption)
error {
consumerConf := cliOpts.Consumer
- // init application
- application := cliOpts.Application
- if application != nil {
- cliOpts.applicationCompat = compatApplicationConfig(application)
- if err := cliOpts.applicationCompat.Init(); err != nil {
- return err
- }
- }
-
// init registries
regs := cliOpts.Registries
- if regs != nil {
- cliOpts.registriesCompat =
make(map[string]*config.RegistryConfig)
+ if len(regs) > 0 {
if len(consumerConf.RegistryIDs) <= 0 {
- consumerConf.RegistryIDs = make([]string, len(regs))
+ consumerConf.RegistryIDs = make([]string, 0, len(regs))
for key := range regs {
consumerConf.RegistryIDs =
append(consumerConf.RegistryIDs, key)
}
}
consumerConf.RegistryIDs =
commonCfg.TranslateIds(consumerConf.RegistryIDs)
+ newRegs := make(map[string]*global.RegistryConfig)
for _, id := range consumerConf.RegistryIDs {
if reg, ok := regs[id]; ok {
- cliOpts.registriesCompat[id] =
compatRegistryConfig(reg)
- if err := cliOpts.registriesCompat[id].Init();
err != nil {
- return err
- }
+ newRegs[id] = reg
}
}
+ cliOpts.Registries = newRegs
Review Comment:
已按建议调整:init() 不再修改 cliOpts.Registries,改为在 dial() 阶段按最终 Reference.RegistryIDs
临时过滤 registry,仅用于本次 metadata/report/refer 流程。原始配置状态保持不变。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]