Mercurial > hg > nginx
diff src/http/modules/ngx_http_upstream_hash_module.c @ 6705:29bf0dbc0a77
Upstream: max_conns.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Thu, 22 Sep 2016 19:32:47 +0300 |
parents | 914d8a63dbad |
children | 6c52b24fcf8e |
line wrap: on
line diff
--- a/src/http/modules/ngx_http_upstream_hash_module.c +++ b/src/http/modules/ngx_http_upstream_hash_module.c @@ -242,6 +242,10 @@ ngx_http_upstream_get_hash_peer(ngx_peer goto next; } + if (peer->max_conns && peer->conns >= peer->max_conns) { + goto next; + } + break; next: @@ -548,6 +552,10 @@ ngx_http_upstream_get_chash_peer(ngx_pee continue; } + if (peer->max_conns && peer->conns >= peer->max_conns) { + continue; + } + peer->current_weight += peer->effective_weight; total += peer->effective_weight; @@ -647,6 +655,7 @@ ngx_http_upstream_hash(ngx_conf_t *cf, n uscf->flags = NGX_HTTP_UPSTREAM_CREATE |NGX_HTTP_UPSTREAM_WEIGHT + |NGX_HTTP_UPSTREAM_MAX_CONNS |NGX_HTTP_UPSTREAM_MAX_FAILS |NGX_HTTP_UPSTREAM_FAIL_TIMEOUT |NGX_HTTP_UPSTREAM_DOWN;