You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/06/07 09:03:31 UTC

[GitHub] [apisix] yxudong commented on a change in pull request #4361: feat: add etcd retry when init

yxudong commented on a change in pull request #4361:
URL: https://github.com/apache/apisix/pull/4361#discussion_r646402268



##########
File path: apisix/cli/etcd.lua
##########
@@ -191,10 +191,21 @@ function _M.init(env, args)
         local version_url = host .. "/version"
         local errmsg
 
-        local 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
-        -- and followed by the response status code.
+        local res, err
+        local retry_time = 0
+        while retry_time < 2 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
+            -- and followed by the response status code.
+            if res then
+                break
+            end
+            retry_time = retry_time + 1
+            print(str_format("Warning! Request etcd endpoint \'%s\' error, %s, retry_time=%s",
+                             version_url, err, retry_time))

Review comment:
       > Ping @yxudong
   
   Get it, I‘ll do it soon.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org