@marcel91200 / caddy Mirror · read-only / commits / e8b8d4a8
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 22:00 UTC

reverseproxy: Fix `least_conn` policy regression (#5862)

Francis Lavoie committed Oct 11, 2023 at 12:04 UTC e8b8d4a8cdf116bf05345443e37a21ea7a37b8bb
1 file changed +1 -1
modules/caddyhttp/reverseproxy/selectionpolicies.go
+1 -1
@@ -269,7 +269,7 @@ func (LeastConnSelection) Select(pool UpstreamPool, _ *http.Request, _ http.Resp
269 // sample: https://en.wikipedia.org/wiki/Reservoir_sampling
270 if numReqs == leastReqs {
271 count++
272 - if count > 1 || (weakrand.Int()%count) == 0 { //nolint:gosec
272 + if count == 1 || (weakrand.Int()%count) == 0 { //nolint:gosec
273 bestHost = host
274 }
275 }