Skip to content
Snippets Groups Projects
Commit f1cce389 authored by xuxiaoliang's avatar xuxiaoliang
Browse files

alter client config by defer delay check

parent 96c699aa
No related branches found
No related tags found
No related merge requests found
......@@ -41,11 +41,22 @@ var (
func init() {
// load clientconfig from consumer_config
// default use grpc
defaultClientConfig := GetDefaultClientConfig()
clientConf = &defaultClientConfig
consumerConfig := config.GetConsumerConfig()
clientConfig := GetClientConfig()
clientConf = &clientConfig
// check client config and decide whether to use the default config
defer func() {
if clientConf == nil || len(clientConf.ContentSubType) == 0 {
defaultClientConfig := GetDefaultClientConfig()
clientConf = &defaultClientConfig
}
if err := clientConf.Validate(); err != nil {
panic(err)
}
}()
if consumerConfig.ApplicationConfig == nil {
return
}
......@@ -69,12 +80,6 @@ func init() {
}
}
if clientConf == nil || len(clientConf.ContentSubType) == 0 {
clientConf = &defaultClientConfig
}
if err := clientConf.Validate(); err != nil {
panic(err)
}
}
// Client return grpc connection and warp service stub
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment