From 5e781ec4671162ee0120c4b4985d7d153ccc5d9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B5=B5=E4=BA=91=E5=85=B4?= <2385585770@qq.com>
Date: Fri, 23 Jul 2021 15:10:10 +0800
Subject: [PATCH] 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 5dbdcce62..bb7e093dd 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
-- 
GitLab