This is an automated email from the ASF dual-hosted git repository.

tokers pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 3878555  chore: dismiss warning "load balancing method redefined" 
(#4520)
3878555 is described below

commit 38785557bee818c3d8a3ca1d46f788fc65ab38ab
Author: 罗泽轩 <[email protected]>
AuthorDate: Mon Jul 5 09:16:43 2021 +0800

    chore: dismiss warning "load balancing method redefined" (#4520)
    
    Signed-off-by: spacewander <[email protected]>
---
 apisix/cli/ngx_tpl.lua | 13 ++++++++++++-
 t/APISIX.pm            | 15 +++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/apisix/cli/ngx_tpl.lua b/apisix/cli/ngx_tpl.lua
index ccbcd5e..166c7a0 100644
--- a/apisix/cli/ngx_tpl.lua
+++ b/apisix/cli/ngx_tpl.lua
@@ -272,15 +272,26 @@ http {
     # http configuration snippet ends
 
     upstream apisix_backend {
+        server 0.0.0.1;
+
+        {% if use_apisix_openresty then %}
         keepalive {* http.upstream.keepalive *};
         keepalive_requests {* http.upstream.keepalive_requests *};
         keepalive_timeout {* http.upstream.keepalive_timeout *};
         # we put the static configuration above so that we can override it in 
the Lua code
 
-        server 0.0.0.1;
         balancer_by_lua_block {
             apisix.http_balancer_phase()
         }
+        {% else %}
+        balancer_by_lua_block {
+            apisix.http_balancer_phase()
+        }
+
+        keepalive {* http.upstream.keepalive *};
+        keepalive_requests {* http.upstream.keepalive_requests *};
+        keepalive_timeout {* http.upstream.keepalive_timeout *};
+        {% end %}
     }
 
     {% if enabled_plugins["dubbo-proxy"] then %}
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 80b4ac8..8d0f609 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -449,12 +449,27 @@ _EOC_
 
     upstream apisix_backend {
         server 0.0.0.1;
+_EOC_
 
+    if ($version =~ m/\/apisix-nginx-module/) {
+    $http_config .= <<_EOC_;
         keepalive 32;
 
         balancer_by_lua_block {
             apisix.http_balancer_phase()
         }
+_EOC_
+    } else {
+    $http_config .= <<_EOC_;
+        balancer_by_lua_block {
+            apisix.http_balancer_phase()
+        }
+
+        keepalive 32;
+_EOC_
+    }
+
+    $http_config .= <<_EOC_;
     }
 
     $dubbo_upstream

Reply via email to