diff --git a/before_ut.bat b/before_ut.bat index 5d2b9e4682d0ac24efe4ae68be8d977933db103f..7f5cf50e900955f784552221569d9caf414274d4 100644 --- a/before_ut.bat +++ b/before_ut.bat @@ -36,5 +36,8 @@ xcopy /f "%zkJar%" "cluster/router/chain/zookeeper-4unittest/contrib/fatjar/" md cluster\router\condition\zookeeper-4unittest\contrib\fatjar xcopy /f "%zkJar%" "cluster/router/condition/zookeeper-4unittest/contrib/fatjar/" +mkdir -p cluster/router/tag/zookeeper-4unittest/contrib/fatjar +cp ${zkJar} cluster/router/tag/zookeeper-4unittest/contrib/fatjar + md metadata\report\zookeeper\zookeeper-4unittest\contrib\fatjar xcopy /f "%zkJar%" "metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar/" \ No newline at end of file diff --git a/cluster/router/tag/tag_router.go b/cluster/router/tag/tag_router.go index 1a4b74d4861ed0a1ba449853ecac033b35c92429..bd5c359524e005a48d593a353118bc0a2c10b3f8 100644 --- a/cluster/router/tag/tag_router.go +++ b/cluster/router/tag/tag_router.go @@ -221,29 +221,27 @@ func filterInvokersWithTag(invokers []protocol.Invoker, url *common.URL, invocat if len(result) > 0 || tagRouterRule.Force { return result } - } else { - // dynamic tag group doesn't have any item about the requested app OR it's null after filtered by - // dynamic tag group but force=false. check static tag - filter := func(invoker protocol.Invoker) bool { - return invoker.GetUrl().GetParam(constant.Tagkey, "") == tag - } - result = filterInvoker(invokers, filter) } + // dynamic tag group doesn't have any item about the requested app OR it's null after filtered by + // dynamic tag group but force=false. check static tag + filter := func(invoker protocol.Invoker) bool { + return invoker.GetUrl().GetParam(constant.Tagkey, "") == tag + } + result = filterInvoker(invokers, filter) // If there's no tagged providers that can match the current tagged request. force.tag is set by default // to false, which means it will invoke any providers without a tag unless it's explicitly disallowed. if len(result) > 0 || isForceUseTag(url, invocation) { return result - } else { - // FAILOVER: return all Providers without any tags. - filterAddressNotMatches := func(invoker protocol.Invoker) bool { - url := invoker.GetUrl() - return len(addresses) == 0 || !checkAddressMatch(tagRouterRule.getAddresses(), url.Ip, url.Port) - } - filterTagIsEmpty := func(invoker protocol.Invoker) bool { - return invoker.GetUrl().GetParam(constant.Tagkey, "") == "" - } - return filterInvoker(invokers, filterAddressNotMatches, filterTagIsEmpty) } + // FAILOVER: return all Providers without any tags. + filterAddressNotMatches := func(invoker protocol.Invoker) bool { + url := invoker.GetUrl() + return len(addresses) == 0 || !checkAddressMatch(tagRouterRule.getAddresses(), url.Ip, url.Port) + } + filterTagIsEmpty := func(invoker protocol.Invoker) bool { + return invoker.GetUrl().GetParam(constant.Tagkey, "") == "" + } + return filterInvoker(invokers, filterAddressNotMatches, filterTagIsEmpty) } // isForceUseTag returns whether force use tag