Skip to content

Commit

Permalink
feat: support for configuring the number of etcd health check retries (
Browse files Browse the repository at this point in the history
…apache#6322)

Co-authored-by: tzssangglass <tzssangglass@gmail.com>
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
  • Loading branch information
3 people authored Feb 18, 2022
1 parent e4658fc commit deb3a56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion apisix/cli/etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions conf/config-default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit deb3a56

Please sign in to comment.