Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions pkg/loadbalance/consist.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,10 @@ func (cb *consistBalancer) GetPicker(e discovery.Result) Picker {
cii, ok := cb.cachedConsistInfo.Load(e.CacheKey)
if !ok {
cii, _, _ = cb.sfg.Do(e.CacheKey, func() (interface{}, error) {
return cb.newConsistInfo(e), nil
ci := cb.newConsistInfo(e)
cb.cachedConsistInfo.Store(e.CacheKey, ci)
return ci, nil
})
cb.cachedConsistInfo.Store(e.CacheKey, cii)
}
ci = cii.(*consistInfo)
} else {
Expand Down
2 changes: 1 addition & 1 deletion pkg/loadbalance/consist_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ func TestWeightedConsistBalance(t *testing.T) {
}
}

func TestConsistPicker_Reblance(t *testing.T) {
func TestConsistPicker_Rebalance(t *testing.T) {
opt := NewConsistentHashOption(getKey)
insList := makeNInstances(10, 10)
e := discovery.Result{
Expand Down