No-SilverBullet commented on code in PR #3164:
URL: https://github.com/apache/dubbo-go/pull/3164#discussion_r2697227823


##########
cluster/router/polaris/router.go:
##########
@@ -53,9 +53,14 @@ var (
 
 func newPolarisRouter(url *common.URL) (*polarisRouter, error) {
 
-       // get from url param
+       // get application name from url param
        applicationName := url.GetParam(constant.ApplicationKey, "")
 
+       // if not found, try to get from SubURL (registry directory scenario)
+       if applicationName == "" {
+               applicationName = url.SubURL.GetParam(constant.ApplicationKey, 
"")
+       }
+
        if applicationName == "" {
                return nil, fmt.Errorf("polaris router must set application 
name")
        }

Review Comment:
   Writing the same conditional logic here would look strange and be difficult 
to understand. Your logic checks if the application is empty; if it is, it 
retrieves the value from the suburl; if it's still empty, it returns an error. 
I think this can be handled within an if statement.



-- 
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]

Reply via email to