From c648b81e3ded7d3ba57bb5786210bf2d0afa9457 Mon Sep 17 00:00:00 2001 From: zonghaishang <yiji@apache.org> Date: Wed, 12 Jun 2019 19:57:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E5=8F=98=E9=87=8F=E5=90=88?= =?UTF-8?q?=E5=B9=B6=E5=88=B0var=E7=94=B3=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cluster/loadbalance/round_robin.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cluster/loadbalance/round_robin.go b/cluster/loadbalance/round_robin.go index 3169b3037..600a95661 100644 --- a/cluster/loadbalance/round_robin.go +++ b/cluster/loadbalance/round_robin.go @@ -62,12 +62,14 @@ func (lb *roundRobinLoadBalance) Select(invokers []protocol.Invoker, invocation cache, _ := methodWeightMap.LoadOrStore(key, &cachedInvokers{}) cachedInvokers := cache.(*cachedInvokers) - clean := false - totalWeight := int64(0) - maxCurrentWeight := int64(math.MinInt64) - var selectedInvoker protocol.Invoker - var selectedWeightRobin *weightedRoundRobin - now := time.Now() + var ( + clean = false + totalWeight = int64(0) + maxCurrentWeight = int64(math.MinInt64) + now = time.Now() + selectedInvoker protocol.Invoker + selectedWeightRobin *weightedRoundRobin + ) for _, invoker := range invokers { var weight = GetWeight(invoker, invocation) -- GitLab