Upstream: jump out of unnecessary loop after matching the status code.

Maxim Dounin mdounin at mdounin.ru
Wed May 13 21:03:02 UTC 2020


Hello!

On Wed, May 13, 2020 at 10:17:18PM +0800, Jim T wrote:

> In ngx_http_upstream_test_next, the loop will continue when the status is
> matched, and the ngx_http_upstream_next_errors is non-repeating. I think we
> can jump out of for the unnecessary loop, and here is my patch:
> 
> # HG changeset patch
> # User Jinhua Tan <312841925 at qq.com>
> # Date 1589378567 -28800
> #      Wed May 13 22:02:47 2020 +0800
> # Node ID c79fcc4cf3acb68ca0e5c7767820c23308c40f6e
> # Parent  028b16e2798f8ec4c6a3d042a6ac8a07f7262690
> Upstream: jump out of unnecessary loop after matching the status code.
> 
> diff -r 028b16e2798f -r c79fcc4cf3ac src/http/ngx_http_upstream.c
> --- a/src/http/ngx_http_upstream.c      Fri May 08 19:19:16 2020 +0300
> +++ b/src/http/ngx_http_upstream.c      Wed May 13 22:02:47 2020 +0800
> @@ -2502,6 +2502,8 @@
>          }
> 
>  #endif
> +
> +        break;
>      }
> 
>  #if (NGX_HTTP_CACHE)
> 
> Thanks!

Committed (with minor changes to commit log), thanks.

-- 
Maxim Dounin
http://mdounin.ru/


More information about the nginx-devel mailing list