From c3b50c78289d4ab3a10c4b809e66294d1de870df Mon Sep 17 00:00:00 2001 From: haozhicui Date: Tue, 21 Jan 2025 17:41:07 +0800 Subject: [PATCH] fix ChooseInstance Signed-off-by: haozhicui --- plugin/loadbalancer/hash/hash.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugin/loadbalancer/hash/hash.go b/plugin/loadbalancer/hash/hash.go index cec7c344..c744338f 100644 --- a/plugin/loadbalancer/hash/hash.go +++ b/plugin/loadbalancer/hash/hash.go @@ -78,7 +78,9 @@ func (g *LoadBalancer) ChooseInstance(criteria *loadbalancer.Criteria, // 按照权重区间来寻找 targetIndex := search.BinarySearch(weightedSlice, uint64(targetValue)) instanceIndex := targetInstances.GetInstances()[targetIndex] - instance := inputInstances.GetInstances()[instanceIndex.Index] + + instance := inputInstances.GetServiceClusters().GetServiceInstances().GetInstances()[instanceIndex.Index] + return instance, nil }