reverse_proxy: Fix invalid argument to Intn in RandomChoice selection

This commit is contained in:
Matthew Holt 2019-11-18 14:22:55 -07:00
parent 9fe54e1c60
commit 8de1a76227
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -132,7 +132,7 @@ func (r RandomChoiceSelection) Select(pool UpstreamPool, _ *http.Request) *Upstr
if !upstream.Available() {
continue
}
j := weakrand.Intn(i)
j := weakrand.Intn(i + 1)
if j < k {
choices[j] = upstream
}