Skip to content

Commit

Permalink
fix smooth weighted roundrobin
Browse files Browse the repository at this point in the history
  • Loading branch information
chaoyuepan committed Nov 19, 2020
1 parent e532ba1 commit f8b91ca
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/smooth-weighted-round-robin.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ func nextWeighted(servers []*Weighted) (best *Weighted) {

w.CurrentWeight += w.EffectiveWeight
total += w.EffectiveWeight
if w.EffectiveWeight < w.Weight {
w.EffectiveWeight++
}

if best == nil || w.CurrentWeight > best.CurrentWeight {
best = w
Expand Down

0 comments on commit f8b91ca

Please sign in to comment.