kingluo commented on code in PR #9456:
URL: https://github.com/apache/apisix/pull/9456#discussion_r1201492291


##########
apisix/core/config_etcd.lua:
##########
@@ -157,45 +369,71 @@ local function flush_watching_streams(self)
 end
 
 
-local function http_waitdir(etcd_cli, key, modified_index, timeout)
-    local opts = {}
-    opts.start_revision = modified_index
-    opts.timeout = timeout
-    opts.need_cancel = true
-    local res_func, func_err, http_cli = etcd_cli:watchdir(key, opts)
-    if not res_func then
-        return nil, func_err
+local function http_waitdir(self, etcd_cli, key, modified_index, timeout)
+    if not watch_ctx.idx[key] then
+        watch_ctx.idx[key] = 1

Review Comment:
   1. min_idx maybe 0, which is an internal state of the main watcher and comes 
from the summary of consumer idx of all resources
   2. after the first watch iteration, the consume idx of the resource will be 
kept in sync with the global min_idx.
   3. the sync gap is small, now the max gap is 100, so the overhead should be 
ignored



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to