AsperforMias commented on code in PR #3834:
URL: https://github.com/apache/dubbo-go/pull/3834#discussion_r4609600865
##########
protocol/triple/triple_invoker.go:
##########
@@ -237,9 +237,16 @@ func parseInvocation(ctx context.Context, url *common.URL,
invocation base.Invoc
}
// parseAttachments injects pre-defined URL attachments into invocation.
+// A call-level timeout already present on the invocation is not overwritten
+// by method/service URL configuration.
func parseAttachments(ctx context.Context, url *common.URL, invocation
base.Invocation) {
for _, key := range triAttachmentKeys {
if val := url.GetParam(key, ""); len(val) > 0 {
+ if key == constant.TimeoutKey {
+ if _, exists := invocation.GetAttachment(key);
exists {
+ continue
+ }
+ }
Review Comment:
保留调用级timeout的,比如`parseAttachments` 会把 url上的参数复制到 invocation
attachment。之前如果调用方已经设置了 `timeout`,比如单次调用设为100ms,这时候就会被url上的5s覆盖,导致调用级超时+失败
##########
protocol/triple/triple_protocol/client.go:
##########
@@ -322,7 +339,7 @@ func applyDefaultTimeout(ctx context.Context, timeout
time.Duration) (context.Co
timeoutVal := ctx.Value(TimeoutKey{})
if timeoutVal != nil {
if s, exist := timeoutVal.(string); exist && s != "" {
- if newTimeout, err := time.ParseDuration(s);
err == nil {
+ if newTimeout, parsed := parseTimeout(s);
parsed {
Review Comment:
done
--
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]