Skip to content

Commit e8b8d4a

Browse files
reverseproxy: Fix least_conn policy regression (#5862)
1 parent a8586b0 commit e8b8d4a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/caddyhttp/reverseproxy/selectionpolicies.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ func (LeastConnSelection) Select(pool UpstreamPool, _ *http.Request, _ http.Resp
269269
// sample: https://en.wikipedia.org/wiki/Reservoir_sampling
270270
if numReqs == leastReqs {
271271
count++
272-
if count > 1 || (weakrand.Int()%count) == 0 { //nolint:gosec
272+
if count == 1 || (weakrand.Int()%count) == 0 { //nolint:gosec
273273
bestHost = host
274274
}
275275
}

0 commit comments

Comments
 (0)