eye-gu commented on code in PR #3714:
URL: https://github.com/apache/dubbo-go/pull/3714#discussion_r3886731919


##########
protocol/dubbo/dubbo_invoker.go:
##########
@@ -163,7 +163,12 @@ func (di *DubboInvoker) Invoke(ctx context.Context, ivc 
base.Invocation) result.
 func (di *DubboInvoker) getTimeout(ivc *invocation.RPCInvocation) 
time.Duration {
        timeout := di.timeout                                                
//default timeout
        if attachTimeout, ok := ivc.GetAttachment(constant.TimeoutKey); ok { 
//check invocation timeout
-               timeout, _ = time.ParseDuration(attachTimeout)
+               // the timeout below is written back as bare milliseconds, so 
accept both formats
+               if d, err := time.ParseDuration(attachTimeout); err == nil {
+                       timeout = d
+               } else if ms, err := strconv.Atoi(attachTimeout); err == nil {
+                       timeout = time.Duration(ms) * time.Millisecond

Review Comment:
   已修复:改用 time.ParseDuration(attachTimeout + "ms") 解析裸毫秒,超范围值保持默认 timeout,并补了 
max-ms 与 max+1 的边界测试



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