You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zhaoyunxing92 (via GitHub)" <gi...@apache.org> on 2023/12/28 13:42:41 UTC
[I] 客户端方法重试次数跟 java 实现不一样 [dubbo-go]
zhaoyunxing92 opened a new issue, #2550:
URL: https://github.com/apache/dubbo-go/issues/2550
### Environment
- Server: Dubbo-go, v3.1.0
- Client: Dubbo-go, v3.1.0
- Protocol: dubbo
- Registry: zk
-
### Issue description
两边实现不一样导致客户端重试计算出来值不一样
## Java
```java
private int calculateInvokeTimes(String methodName) {
int len = getUrl().getMethodParameter(methodName, RETRIES_KEY, DEFAULT_RETRIES) + 1;
RpcContext rpcContext = RpcContext.getClientAttachment();
Object retry = rpcContext.getObjectAttachment(RETRIES_KEY);
if (retry instanceof Number) {
len = ((Number) retry).intValue() + 1;
rpcContext.removeAttachment(RETRIES_KEY);
}
if (len <= 0) {
len = 1;
}
return len;
}
```
## Go
```go
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
}
```
--
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: notifications-unsubscribe@dubbo.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] 客户端方法重试次数跟 java 实现不一样 [dubbo-go]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj commented on issue #2550:
URL: https://github.com/apache/dubbo-go/issues/2550#issuecomment-1872462813
Hi @zhaoyunxing92, would you like to fix this issue?
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [I] 客户端方法重试次数跟 java 实现不一样 [dubbo-go]
Posted by "chickenlj (via GitHub)" <gi...@apache.org>.
chickenlj closed issue #2550: 客户端方法重试次数跟 java 实现不一样
URL: https://github.com/apache/dubbo-go/issues/2550
--
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: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org