From ab37b2e19830449e090f4dbad3be9e31a3ea4df5 Mon Sep 17 00:00:00 2001 From: Joe Zou <yixian.zou@gmail.com> Date: Tue, 22 Sep 2020 12:30:07 +0800 Subject: [PATCH] fix travis fail --- cluster/router/tag/tag_router.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cluster/router/tag/tag_router.go b/cluster/router/tag/tag_router.go index a5f1dc13d..fafed68c7 100644 --- a/cluster/router/tag/tag_router.go +++ b/cluster/router/tag/tag_router.go @@ -69,6 +69,7 @@ func (c *tagRouter) Route(invokers []protocol.Invoker, url *common.URL, invocati var ( result []protocol.Invoker addresses []string + tag string ) if !c.isEnabled() || len(invokers) == 0 { @@ -83,9 +84,14 @@ func (c *tagRouter) Route(invokers []protocol.Invoker, url *common.URL, invocati // since the rule can be changed by config center, we should copy one to use. tagRouterRuleCopy := new(RouterRule) _ = copier.Copy(tagRouterRuleCopy, c.tagRouterRule) - tag, ok := invocation.Attachments()[constant.Tagkey] + tagValue, ok := invocation.Attachments()[constant.Tagkey] if !ok { tag = url.GetParam(constant.Tagkey, "") + } else { + tag, ok = tagValue.(string) + if !ok { + tag = url.GetParam(constant.Tagkey, "") + } } // if we are requesting for a Provider with a specific tag -- GitLab