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

monkeydluffy 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 68287e9ce fix(etcd): reuse cli and enable keepalive (#9420)
68287e9ce is described below

commit 68287e9ce3d8dc68b16d9a9d83a0ed8681030b42
Author: jinhua luo <[email protected]>
AuthorDate: Wed May 17 19:09:32 2023 +0800

    fix(etcd): reuse cli and enable keepalive (#9420)
---
 apisix/cli/snippet.lua |  3 +++
 apisix/core/etcd.lua   |  4 +---
 t/core/config_etcd.t   |  1 -
 t/core/etcd.t          | 32 --------------------------------
 4 files changed, 4 insertions(+), 36 deletions(-)

diff --git a/apisix/cli/snippet.lua b/apisix/cli/snippet.lua
index ca7ed3f7c..95069a0ab 100644
--- a/apisix/cli/snippet.lua
+++ b/apisix/cli/snippet.lua
@@ -28,6 +28,9 @@ upstream apisix_conf_backend {
         local conf_server = require("apisix.conf_server")
         conf_server.balancer()
     }
+    keepalive 320;
+    keepalive_requests 1000;
+    keepalive_timeout 60s;
 }
 
 {% if trusted_ca_cert then %}
diff --git a/apisix/core/etcd.lua b/apisix/core/etcd.lua
index 99e4bbb6b..b52517cd4 100644
--- a/apisix/core/etcd.lua
+++ b/apisix/core/etcd.lua
@@ -372,9 +372,7 @@ do
                 return nil, nil, err
             end
 
-            if tmp_etcd_cli.use_grpc then
-                etcd_cli = tmp_etcd_cli
-            end
+            etcd_cli = tmp_etcd_cli
 
             return tmp_etcd_cli, prefix
         end
diff --git a/t/core/config_etcd.t b/t/core/config_etcd.t
index 380b82522..666d001b2 100644
--- a/t/core/config_etcd.t
+++ b/t/core/config_etcd.t
@@ -266,7 +266,6 @@ qr/etcd auth failed/
 etcd auth failed
 etcd auth failed
 etcd auth failed
-etcd auth failed
 
 
 
diff --git a/t/core/etcd.t b/t/core/etcd.t
index eaa425ec6..c0715de7b 100644
--- a/t/core/etcd.t
+++ b/t/core/etcd.t
@@ -401,35 +401,3 @@ qr/init_by_lua:\d+: \S+/
 init_by_lua:12: ab
 init_by_lua:19: 200
 init_by_lua:26: 404
-
-
-
-=== TEST 8: error handling in server_version
---- yaml_config
-deployment:
-  role: traditional
-  role_traditional:
-    config_provider: etcd
-  etcd:
-    host:
-      - "http://127.0.0.1:2379";
-    prefix: "/apisix"
---- config
-    location /t {
-        content_by_lua_block {
-            local etcd_lib = require("resty.etcd")
-            -- the mock won't take effect when using gRPC because the 
connection will be cached
-            etcd_lib.new = function()
-                return nil, "ouch"
-            end
-            local etcd = require("apisix.core.etcd")
-            local res, err = etcd.server_version()
-            ngx.say(err)
-        }
-    }
---- request
-GET /t
---- response_body
-ouch
---- error_log
-failed to get server_info from etcd

Reply via email to