You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2022/01/12 03:35:56 UTC
[dubbo] branch master updated: Fix callback timeout (#9463)
This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 8240ea2 Fix callback timeout (#9463)
8240ea2 is described below
commit 8240ea26cb00a52dd000d99e3997fe554134b9c3
Author: wuwen <wu...@aliyun.com>
AuthorDate: Wed Jan 12 11:30:28 2022 +0800
Fix callback timeout (#9463)
---
.../org/apache/dubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java
index cf8b569..6907af2 100644
--- a/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java
+++ b/dubbo-rpc/dubbo-rpc-dubbo/src/main/java/org/apache/dubbo/rpc/protocol/dubbo/ChannelWrappedInvoker.java
@@ -28,6 +28,7 @@ import org.apache.dubbo.rpc.AppResponse;
import org.apache.dubbo.rpc.AsyncRpcResult;
import org.apache.dubbo.rpc.Invocation;
import org.apache.dubbo.rpc.Result;
+import org.apache.dubbo.rpc.RpcContext;
import org.apache.dubbo.rpc.RpcException;
import org.apache.dubbo.rpc.RpcInvocation;
import org.apache.dubbo.rpc.protocol.AbstractInvoker;
@@ -36,6 +37,7 @@ import org.apache.dubbo.rpc.support.RpcUtils;
import java.net.InetSocketAddress;
import java.util.concurrent.CompletableFuture;
+import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_TIMEOUT;
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.PATH_KEY;
import static org.apache.dubbo.remoting.Constants.SENT_KEY;
@@ -71,7 +73,9 @@ class ChannelWrappedInvoker<T> extends AbstractInvoker<T> {
currentClient.send(inv, getUrl().getMethodParameter(invocation.getMethodName(), SENT_KEY, false));
return AsyncRpcResult.newDefaultAsyncResult(invocation);
} else {
- CompletableFuture<AppResponse> appResponseFuture = currentClient.request(inv).thenApply(obj -> (AppResponse) obj);
+ final String methodName = RpcUtils.getMethodName(invocation);
+ final int timeout = (int) RpcUtils.getTimeout(getUrl(), methodName, RpcContext.getContext(), DEFAULT_TIMEOUT);
+ CompletableFuture<AppResponse> appResponseFuture = currentClient.request(inv, timeout, null).thenApply(obj -> (AppResponse) obj);
return new AsyncRpcResult(appResponseFuture, inv);
}
} catch (RpcException e) {