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

Ensure we don't schedule reloading configuration when reloading is disabled #1468

Merged
Merged
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
23 changes: 8 additions & 15 deletions gateway/src/apicast/configuration_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -204,22 +204,15 @@
schedule(interval, handler, ...)
end

-- Check whether the reserved boot configuration is fresh or stale.
-- If it is stale, refresh configuration
-- When a worker process is (re-)spawned,
-- it will start working with fresh (according the ttl semantics) configuration
local boot_reserved_hosts = configuration:find_by_host(boot_reserved_domain, false)
if(#boot_reserved_hosts == 0)
then
-- the boot configuration has expired, load fresh config
ngx.log(ngx.INFO, 'boot time configuration has expired')
-- ngx.socket.tcp is not available at the init or init_worker phases,
-- it needs to be scheduled (with delay = 0)
schedule(0, handler, configuration)
elseif(interval > 0)
then
if interval > 0 then

Check warning on line 207 in gateway/src/apicast/configuration_loader.lua

View check run for this annotation

Codecov / codecov/patch

gateway/src/apicast/configuration_loader.lua#L207

Added line #L207 was not covered by tests
-- Check whether the reserved boot configuration is fresh or stale.
-- If it is stale, refresh configuration
-- When a worker process is (re-)spawned,
-- it will start working with fresh (according the ttl semantics) configuration
local boot_reserved_hosts = configuration:find_by_host(boot_reserved_domain, false)

Check warning on line 212 in gateway/src/apicast/configuration_loader.lua

View check run for this annotation

Codecov / codecov/patch

gateway/src/apicast/configuration_loader.lua#L212

Added line #L212 was not covered by tests
ngx.log(ngx.DEBUG, 'schedule new configuration loading')
schedule(interval, handler, configuration)
local curr_interval = #boot_reserved_hosts == 0 and 0 or interval
schedule(curr_interval, handler, configuration)

Check warning on line 215 in gateway/src/apicast/configuration_loader.lua

View check run for this annotation

Codecov / codecov/patch

gateway/src/apicast/configuration_loader.lua#L214-L215

Added lines #L214 - L215 were not covered by tests
else
ngx.log(ngx.DEBUG, 'no scheduling for configuration loading')
end
Expand Down
Loading