Skip to content

Commit c77a178

Browse files
authored
feat(patch): control the proxy_upstream in lua side (#14029)
Sister PR: Kong/lua-kong-nginx-module#98 AG-186
1 parent 5b0da6d commit c77a178

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.requirements

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ LIBEXPAT_SHA256=d4cf38d26e21a56654ffe4acd9cd5481164619626802328506a2869afab29ab3
1515

1616
# Note: git repositories can be loaded from local path if path is set as value
1717

18-
LUA_KONG_NGINX_MODULE=f85f92191fb98dbeec614a418d46b008f6a107ce # 0.14.0
18+
LUA_KONG_NGINX_MODULE=c967e8326179c86680c0f34d82ee087765aed19a # 0.15.0
1919
LUA_RESTY_LMDB=9da0e9f3313960d06e2d8e718b7ac494faa500f1 # 1.6.0
2020
LUA_RESTY_EVENTS=bc85295b7c23eda2dbf2b4acec35c93f77b26787 # 0.3.1
2121
LUA_RESTY_SIMDJSON=7e6466ce91b2bc763b45701a4f055e94b1e8143b # 1.1.0
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
2+
index 2be233c..7f7132d 100644
3+
--- a/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
4+
+++ b/bundle/nginx-1.25.3/src/http/ngx_http_upstream.c
5+
@@ -2563,7 +2563,11 @@ ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u)
6+
}
7+
8+
if (u->peer.tries > 1
9+
+#if (NGX_HTTP_LUA_KONG)
10+
+ && ((ngx_http_lua_kong_get_next_upstream_mask(r, u->conf->next_upstream) & mask) == mask)
11+
+#else
12+
&& ((u->conf->next_upstream & mask) == mask)
13+
+#endif
14+
&& !(u->request_sent && r->request_body_no_buffering)
15+
&& !(timeout && ngx_current_msec - u->peer.start_time >= timeout))
16+
{
17+
@@ -4420,7 +4424,12 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
18+
}
19+
20+
if (u->peer.tries == 0
21+
+#if (NGX_HTTP_LUA_KONG)
22+
+ || ((ngx_http_lua_kong_get_next_upstream_mask(r, u->conf->next_upstream) & ft_type) != ft_type)
23+
+#else
24+
|| ((u->conf->next_upstream & ft_type) != ft_type)
25+
+#endif
26+
+
27+
|| (u->request_sent && r->request_body_no_buffering)
28+
|| (timeout && ngx_current_msec - u->peer.start_time >= timeout))
29+
{
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
message: |
2+
Add a patch for kong.resty.set_next_upstream() to control the next upstream retry logic in lua side. [Kong/lua-kong-nginx-module#98](https://github.com/Kong/lua-kong-nginx-module/pull/98)
3+
type: bugfix
4+
scope: Core

0 commit comments

Comments
 (0)