From a41a9be64bba4f7ed67df1dc20b9911813ce25d0 Mon Sep 17 00:00:00 2001 From: zhangrongjun Date: Wed, 15 May 2019 19:22:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E5=90=8C=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E5=AE=9E=E4=BE=8B=E6=B3=A8=E5=86=8C=E5=88=B0=E4=B8=A4?= =?UTF-8?q?=E4=B8=AAconsul=E5=AE=A2=E6=88=B7=E7=AB=AF=E4=B8=8A=EF=BC=8C?= =?UTF-8?q?=E4=BB=8Econsul=E7=9A=84=E4=B8=80=E4=B8=AA=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E4=B8=8B=E7=BA=BF=E5=AE=9E=E4=BE=8B=EF=BC=8Cngx=5Fhtt?= =?UTF-8?q?p=5Fupsync=5Fserver=5Ft=E6=A0=B9=E6=8D=AEip=E4=B8=8Eport?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AE=9E=E4=BE=8B=EF=BC=8C=E4=BC=9A=E6=8A=8A?= =?UTF-8?q?=E4=B8=A4=E4=B8=AA=E5=AE=9E=E4=BE=8B=E9=83=BD=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=88=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=E6=9C=89bug?= =?UTF-8?q?=EF=BC=89=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=90=8E=E7=BB=AD=E4=B8=8D?= =?UTF-8?q?=E8=BF=9B=E8=A1=8C=E6=9C=8D=E5=8A=A1=E5=8F=91=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ngx_http_upsync_module.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ngx_http_upsync_module.c b/src/ngx_http_upsync_module.c index 49d8a71..07daf9e 100644 --- a/src/ngx_http_upsync_module.c +++ b/src/ngx_http_upsync_module.c @@ -1070,7 +1070,7 @@ static ngx_int_t ngx_http_upsync_del_peers(ngx_cycle_t *cycle, ngx_http_upsync_server_t *upsync_server) { - ngx_uint_t i, n=0, w=0, len; + ngx_uint_t i, n=0, w=0, del_count=0, len; ngx_array_t *servers; ngx_http_upstream_server_t *server = NULL; ngx_http_upstream_rr_peer_t *peer = NULL, *pre_peer = NULL; @@ -1114,6 +1114,9 @@ ngx_http_upsync_del_peers(ngx_cycle_t *cycle, pre_peer = peers->peer; for (peer = peers->peer; peer; peer = peer->next) { + if (del_count == 1) { + break; + } for (i = 0; i < servers->nelts; i++) { server = (ngx_http_upstream_server_t *)servers->elts + i; @@ -1121,7 +1124,7 @@ ngx_http_upsync_del_peers(ngx_cycle_t *cycle, (u_char *) server->addrs->sockaddr, len, len) == 0) { - + del_count = 1; #if (NGX_HTTP_UPSTREAM_CHECK) ngx_http_upstream_check_delete_dynamic_peer( peers->name, server->addrs);