membphis commented on a change in pull request #1888:
URL: https://github.com/apache/incubator-apisix/pull/1888#discussion_r462603072



##########
File path: apisix/core/config_etcd.lua
##########
@@ -201,10 +221,24 @@ local function sync_data(self)
         return true
     end
 
-    local dir_res, err = waitdir(self.etcd_cli, self.key, self.prev_index + 1)
+    -- for fetch the etcd index
+    local key_res, _ = getkey(self.etcd_cli, self.key)

Review comment:
       we need to capture the `err` message and check it first

##########
File path: apisix/core/config_etcd.lua
##########
@@ -228,7 +228,7 @@ local function sync_data(self)
 
     log.info("waitdir key: ", self.key, " prev_index: ", self.prev_index + 1)
     log.info("res: ", json.delay_encode(dir_res, true))
-    if not dir_res then
+    if err and err == "timeout" then

Review comment:
       `if err == "timeout" then` is enough




----------------------------------------------------------------
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:
[email protected]


Reply via email to