You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/02/18 02:42:51 UTC

[apisix] branch master updated: feat: support for configuring the number of etcd health check retries (#6322)

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

spacewander 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 deb3a56  feat: support for configuring the number of etcd health check retries (#6322)
deb3a56 is described below

commit deb3a56eae10087db7a85d877be14523b834fefc
Author: tyltr <ty...@126.com>
AuthorDate: Fri Feb 18 10:42:47 2022 +0800

    feat: support for configuring the number of etcd health check retries (#6322)
    
    Co-authored-by: tzssangglass <tz...@gmail.com>
    Co-authored-by: 罗泽轩 <sp...@gmail.com>
---
 apisix/cli/etcd.lua      | 4 +++-
 conf/config-default.yaml | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/apisix/cli/etcd.lua b/apisix/cli/etcd.lua
index 53c4146..9edfbcd 100644
--- a/apisix/cli/etcd.lua
+++ b/apisix/cli/etcd.lua
@@ -196,7 +196,9 @@ function _M.init(env, args)
 
         local res, err
         local retry_time = 0
-        while retry_time < 2 do
+
+        local health_check_retry = tonumber(yaml_conf.etcd.health_check_retry) or 2
+        while retry_time < health_check_retry do
             res, err = request(version_url, yaml_conf)
             -- In case of failure, request returns nil followed by an error message.
             -- Else the first return value is the response body
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 6a8362a..c49272e 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -274,6 +274,7 @@ etcd:
   timeout: 30                     # 30 seconds
   #resync_delay: 5                # when sync failed and a rest is needed, resync after the configured seconds plus 50% random jitter
   #health_check_timeout: 10       # etcd retry the unhealthy nodes after the configured seconds
+  health_check_retry: 2           # etcd retry time that only affects the health check, default 2
   #user: root                     # root username for etcd
   #password: 5tHkHhYkjr6cQY       # root password for etcd
   tls: