Skip to content

Commit

Permalink
perf(standalone): load configuration in the init phase (apache#3782)
Browse files Browse the repository at this point in the history
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander authored Mar 9, 2021
1 parent 630769c commit c530135
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apisix/core/config_yaml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -358,9 +358,13 @@ function _M.fetch_created_obj(key)
end


function _M.init()
read_apisix_yaml()
end


function _M.init_worker()
-- sync data in each non-master process
read_apisix_yaml()
ngx.timer.every(1, read_apisix_yaml)
end

Expand Down
8 changes: 8 additions & 0 deletions apisix/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ function _M.http_init(args)
if not ok then
core.log.error("failed to enable privileged_agent: ", err)
end

if core.config == require("apisix.core.config_yaml") then
core.config.init()
end
end


Expand Down Expand Up @@ -694,6 +698,10 @@ end

function _M.stream_init()
core.log.info("enter stream_init")

if core.config == require("apisix.core.config_yaml") then
core.config.init()
end
end


Expand Down

0 comments on commit c530135

Please sign in to comment.