Welcome! Log In Create A New Profile

Advanced

[PATCH] Upstream: limited next_upstream time and tries when resolving DNS

October 27, 2014 07:56AM
# HG changeset patch
# User Gu Feng <flygoast@126.com>
# Date 1414410723 -28800
# Mon Oct 27 19:52:03 2014 +0800
# Node ID ccc3b86835da54273c333e7d6a00f68e0b0e6c27
# Parent 973fded4f461f3a397779b3a1dc80881b1b34974
Upstream: limited next_upstream time and tries when resolving DNS.

When got multiple upstream IP addresses using DNS resolving, the number of
upstreams tries and the maxinum time spent for these tries were not affected.
This patch fixed it.

diff -r 973fded4f461 -r ccc3b86835da src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Wed Oct 15 22:57:23 2014 +0400
+++ b/src/http/ngx_http_upstream.c Mon Oct 27 19:52:03 2014 +0800
@@ -974,6 +974,14 @@ ngx_http_upstream_resolve_handler(ngx_re
ngx_resolve_name_done(ctx);
ur->ctx = NULL;

+ u->peer.start_time = ngx_current_msec;
+
+ if (u->conf->next_upstream_tries
+ && u->peer.tries > u->conf->next_upstream_tries)
+ {
+ u->peer.tries = u->conf->next_upstream_tries;
+ }
+
ngx_http_upstream_connect(r, u);

failed:

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Upstream: limited next_upstream time and tries when resolving DNS

flygoast 671 October 27, 2014 07:56AM

Re: [PATCH] Upstream: limited next_upstream time and tries when resolving DNS

Roman Arutyunyan 304 October 28, 2014 08:54AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 99
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready