Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(config_etcd): skip resync_delay while etcd watch timeout #6259

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion apisix/core/config_etcd.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion t/core/etcd-sync.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down