diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c index de34b2884..c15790aa0 100644 --- a/src/http/ngx_http_upstream_round_robin.c +++ b/src/http/ngx_http_upstream_round_robin.c @@ -585,7 +585,7 @@ failed: static ngx_uint_t ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers) { - ngx_uint_t i, n; + ngx_uint_t i, n, reset = 0; ngx_http_upstream_rr_peer_t *peer; peer = &peers->peer[0]; @@ -624,6 +624,10 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peers_t *peers) return n; } + if (reset++) { + return 0; + } + for (i = 0; i < peers->number; i++) { peer[i].current_weight = peer[i].weight; }