Mercurial > hg > nginx
diff src/http/modules/ngx_http_upstream_hash_module.c @ 6099:6ff0ebd6fbf4
Upstream: track the number of active connections to upstreams.
This also simplifies the implementation of the least_conn module.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 10 Apr 2015 13:16:23 +0300 |
parents | 435ee290c2e1 |
children | c44459611d91 |
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 @@ -262,6 +262,8 @@ ngx_http_upstream_get_hash_peer(ngx_peer pc->socklen = peer->socklen; pc->name = &peer->name; + peer->conns++; + if (now - peer->checked > peer->fail_timeout) { peer->checked = now; } @@ -562,6 +564,8 @@ ngx_http_upstream_get_chash_peer(ngx_pee pc->socklen = best->socklen; pc->name = &best->name; + best->conns++; + return NGX_OK; }