You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/07/23 07:10:20 UTC

[dubbo-go] branch 1.5 updated: fix:generic method timeout (#1338)

This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/1.5 by this push:
     new 5e781ec  fix:generic method timeout (#1338)
5e781ec is described below

commit 5e781ec4671162ee0120c4b4985d7d153ccc5d9e
Author: 赵云兴 <23...@qq.com>
AuthorDate: Fri Jul 23 15:10:10 2021 +0800

    fix:generic method timeout (#1338)
---
 protocol/dubbo/dubbo_invoker.go | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go
index 5dbdcce..bb7e093 100644
--- a/protocol/dubbo/dubbo_invoker.go
+++ b/protocol/dubbo/dubbo_invoker.go
@@ -168,7 +168,14 @@ func (di *DubboInvoker) Invoke(ctx context.Context, invocation protocol.Invocati
 
 // get timeout including methodConfig
 func (di *DubboInvoker) getTimeout(invocation *invocation_impl.RPCInvocation) time.Duration {
-	var timeout = di.GetURL().GetParam(strings.Join([]string{constant.METHOD_KEYS, invocation.MethodName(), constant.TIMEOUT_KEY}, "."), "")
+
+	methodName := invocation.MethodName()
+	if di.GetURL().GetParamBool(constant.GENERIC_KEY, false) {
+		methodName = invocation.Arguments()[0].(string)
+	}
+
+	key := strings.Join([]string{constant.METHOD_KEYS, methodName, constant.TIMEOUT_KEY}, ".")
+	timeout := di.GetURL().GetParam(key, "")
 	if len(timeout) != 0 {
 		if t, err := time.ParseDuration(timeout); err == nil {
 			// config timeout into attachment