gaoxinge commented on a change in pull request #722:
URL: https://github.com/apache/dubbo-go/pull/722#discussion_r481173459
##########
File path: config/service_config.go
##########
@@ -196,33 +196,31 @@ func (c *ServiceConfig) Export() error {
ivkURL.AddParam(constant.Tagkey, c.Tag)
}
- var exporter protocol.Exporter
-
if len(regUrls) > 0 {
+ c.cacheMutex.Lock()
+ if c.cacheProtocol == nil {
+ logger.Infof(fmt.Sprintf("First load the
registry protocol, url is {%v}!", ivkURL))
+ c.cacheProtocol =
extension.GetProtocol("registry")
+ }
+ c.cacheMutex.Unlock()
+
for _, regUrl := range regUrls {
regUrl.SubURL = ivkURL
-
- c.cacheMutex.Lock()
- if c.cacheProtocol == nil {
- logger.Infof(fmt.Sprintf("First load
the registry protocol , url is {%v}!", ivkURL))
- c.cacheProtocol =
extension.GetProtocol("registry")
- }
- c.cacheMutex.Unlock()
-
- invoker :=
extension.GetProxyFactory(providerConfig.ProxyFactory).GetInvoker(*regUrl)
- exporter = c.cacheProtocol.Export(invoker)
+ invoker := proxyFactory.GetInvoker(*regUrl)
+ exporter := c.cacheProtocol.Export(invoker)
if exporter == nil {
- panic(perrors.New(fmt.Sprintf("Registry
protocol new exporter error,registry is {%v},url is {%v}", regUrl, ivkURL)))
+ return
perrors.New(fmt.Sprintf("Registry protocol new exporter error, registry is
{%v}, url is {%v}", regUrl, ivkURL))
Review comment:
This method requires an error when return:
https://github.com/apache/dubbo-go/blob/4c483e0e4a5a2266eaf5df5e7b919a1560ba5722/config/service_config.go#L145
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]