# 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