Skip to content

Commit

Permalink
caddyhttp: reverseproxy: fix hash selection policy
Browse files Browse the repository at this point in the history
Fixes: #4135
Test: go test './...' -count=1
  • Loading branch information
simaotwx committed Apr 29, 2021
1 parent 3a1e81d commit 4438c8f
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions modules/caddyhttp/reverseproxy/selectionpolicies.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,7 @@ func hostByHashing(pool []*Upstream, s string) *Upstream {
}
index := hash(s) % poolLen
for i := uint32(0); i < poolLen; i++ {
index += i
upstream := pool[index%poolLen]
upstream := pool[(index+i)%poolLen]
if upstream.Available() {
return upstream
}
Expand Down

0 comments on commit 4438c8f

Please sign in to comment.