This is an automated email from the ASF dual-hosted git repository. hefengen pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/shenyu.git
The following commit(s) were added to refs/heads/master by this push: new 4a4a1e5029 [type:fix] set timeout which from rule handle to dubbo rpc context (#5778) 4a4a1e5029 is described below commit 4a4a1e50295da4adb5d8f43c68a6878a09dd6c80 Author: eye-gu <734164...@qq.com> AuthorDate: Fri Nov 22 11:50:38 2024 +0800 [type:fix] set timeout which from rule handle to dubbo rpc context (#5778) --- .../org/apache/shenyu/plugin/apache/dubbo/ApacheDubboPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/ApacheDubboPlugin.java b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/ApacheDubboPlugin.java index 4ec4b7d41d..eb1e00ff04 100644 --- a/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/ApacheDubboPlugin.java +++ b/shenyu-plugin/shenyu-plugin-proxy/shenyu-plugin-rpc/shenyu-plugin-dubbo/shenyu-plugin-apache-dubbo/src/main/java/org/apache/shenyu/plugin/apache/dubbo/ApacheDubboPlugin.java @@ -17,11 +17,14 @@ package org.apache.shenyu.plugin.apache.dubbo; +import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.rpc.RpcContext; import org.apache.shenyu.common.constant.Constants; import org.apache.shenyu.common.dto.MetaData; import org.apache.shenyu.common.dto.RuleData; import org.apache.shenyu.common.dto.SelectorData; +import org.apache.shenyu.common.dto.convert.rule.impl.DubboRuleHandle; +import org.apache.shenyu.plugin.apache.dubbo.handler.ApacheDubboPluginDataHandler; import org.apache.shenyu.plugin.apache.dubbo.proxy.ApacheDubboProxyService; import org.apache.shenyu.plugin.api.ShenyuPluginChain; import org.apache.shenyu.plugin.dubbo.common.AbstractDubboPlugin; @@ -63,6 +66,10 @@ public class ApacheDubboPlugin extends AbstractDubboPlugin { final RuleData rule, final MetaData metaData, final String param) { + DubboRuleHandle dubboRuleHandle = ApacheDubboPluginDataHandler.RULE_CACHED_HANDLE.get().obtainHandle(rule.getId()); + if (dubboRuleHandle.getTimeout() > 0) { + RpcContext.getClientAttachment().setAttachment(CommonConstants.TIMEOUT_KEY, dubboRuleHandle.getTimeout()); + } RpcContext.getClientAttachment().setAttachment(Constants.DUBBO_SELECTOR_ID, selector.getId()); RpcContext.getClientAttachment().setAttachment(Constants.DUBBO_RULE_ID, rule.getId()); RpcContext.getClientAttachment().setAttachment(Constants.DUBBO_REMOTE_ADDRESS, Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress());