chickenlj commented on code in PR #2564:
URL: https://github.com/apache/dubbo-go/pull/2564#discussion_r1444465463


##########
cluster/cluster/failover/cluster_invoker.go:
##########
@@ -114,23 +113,7 @@ func getRetries(invokers []protocol.Invoker, methodName 
string) int {
        if len(invokers) <= 0 {
                return constant.DefaultRetriesInt
        }
-
        url := invokers[0].GetURL()
-       // get reties
-       retriesConfig := url.GetParam(constant.RetriesKey, 
constant.DefaultRetries)
-       // Get the service method loadbalance config if have
-       if v := url.GetMethodParam(methodName, constant.RetriesKey, ""); len(v) 
!= 0 {
-               retriesConfig = v
-       }
-
-       retries, err := strconv.Atoi(retriesConfig)
-       if err != nil || retries < 0 {
-               logger.Error("Your retries config is invalid,pls do a check. 
And will use the default retries configuration instead.")
-               retries = constant.DefaultRetriesInt
-       }
-
-       if retries > len(invokers) {
-               retries = len(invokers)
-       }
-       return retries
+       return url.GetMethodParamIntValue(methodName, constant.RetriesKey,
+               url.GetParamByIntValue(constant.RetriesKey, 
constant.DefaultRetriesInt))

Review Comment:
   Should we check the case when `retries` is set as negative? 



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