comparison src/stream/ngx_stream_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
comparison
equal deleted inserted replaced
6704:a44ba757851d 6705:29bf0dbc0a77
239 && now - peer->checked <= peer->fail_timeout) 239 && now - peer->checked <= peer->fail_timeout)
240 { 240 {
241 goto next; 241 goto next;
242 } 242 }
243 243
244 if (peer->max_conns && peer->conns >= peer->max_conns) {
245 goto next;
246 }
247
244 break; 248 break;
245 249
246 next: 250 next:
247 251
248 if (++hp->tries > 20) { 252 if (++hp->tries > 20) {
547 && now - peer->checked <= peer->fail_timeout) 551 && now - peer->checked <= peer->fail_timeout)
548 { 552 {
549 continue; 553 continue;
550 } 554 }
551 555
556 if (peer->max_conns && peer->conns >= peer->max_conns) {
557 continue;
558 }
559
552 peer->current_weight += peer->effective_weight; 560 peer->current_weight += peer->effective_weight;
553 total += peer->effective_weight; 561 total += peer->effective_weight;
554 562
555 if (peer->effective_weight < peer->weight) { 563 if (peer->effective_weight < peer->weight) {
556 peer->effective_weight++; 564 peer->effective_weight++;
644 "load balancing method redefined"); 652 "load balancing method redefined");
645 } 653 }
646 654
647 uscf->flags = NGX_STREAM_UPSTREAM_CREATE 655 uscf->flags = NGX_STREAM_UPSTREAM_CREATE
648 |NGX_STREAM_UPSTREAM_WEIGHT 656 |NGX_STREAM_UPSTREAM_WEIGHT
657 |NGX_STREAM_UPSTREAM_MAX_CONNS
649 |NGX_STREAM_UPSTREAM_MAX_FAILS 658 |NGX_STREAM_UPSTREAM_MAX_FAILS
650 |NGX_STREAM_UPSTREAM_FAIL_TIMEOUT 659 |NGX_STREAM_UPSTREAM_FAIL_TIMEOUT
651 |NGX_STREAM_UPSTREAM_DOWN; 660 |NGX_STREAM_UPSTREAM_DOWN;
652 661
653 if (cf->args->nelts == 2) { 662 if (cf->args->nelts == 2) {