diff --git a/apisix/core/config_etcd.lua b/apisix/core/config_etcd.lua index fa2b09e90dc6..dc7fc3838ab7 100644 --- a/apisix/core/config_etcd.lua +++ b/apisix/core/config_etcd.lua @@ -579,7 +579,10 @@ local function _automatic_fetch(premature, self) end end - ngx_sleep(self.resync_delay + rand() * 0.5 * self.resync_delay) + -- etcd watch timeout is an expected error, so there is no need for resync_delay + if err ~= "timeout" then + ngx_sleep(self.resync_delay + rand() * 0.5 * self.resync_delay) + end elseif not ok then -- no error. reentry the sync with different state ngx_sleep(0.05) diff --git a/t/core/etcd-sync.t b/t/core/etcd-sync.t index 42a4c72dc342..a1e674218f91 100644 --- a/t/core/etcd-sync.t +++ b/t/core/etcd-sync.t @@ -27,7 +27,6 @@ __DATA__ etcd: host: - "http://127.0.0.1:2379" - resync_delay: 0.5 # resync after timeout --- config location /t { content_by_lua_block {