mirror of
https://github.com/caddyserver/caddy.git
synced 2025-05-31 16:39:06 +08:00
reverseproxy: Fix round robin data race (#4038)
This commit is contained in:
@ -221,8 +221,8 @@ func (r *RoundRobinSelection) Select(pool UpstreamPool, _ *http.Request, _ http.
|
||||
return nil
|
||||
}
|
||||
for i := uint32(0); i < n; i++ {
|
||||
atomic.AddUint32(&r.robin, 1)
|
||||
host := pool[r.robin%n]
|
||||
robin := atomic.AddUint32(&r.robin, 1)
|
||||
host := pool[robin%n]
|
||||
if host.Available() {
|
||||
return host
|
||||
}
|
||||
|
Reference in New Issue
Block a user