This is an automated email from the ASF dual-hosted git repository.
shuyangw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new c530135 perf(standalone): load configuration in the init phase (#3782)
c530135 is described below
commit c530135c5a179c99637d52d99e0e8a45ce4cc8b8
Author: 罗泽轩 <[email protected]>
AuthorDate: Tue Mar 9 10:12:39 2021 +0800
perf(standalone): load configuration in the init phase (#3782)
Signed-off-by: spacewander <[email protected]>
---
apisix/core/config_yaml.lua | 6 +++++-
apisix/init.lua | 8 ++++++++
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/apisix/core/config_yaml.lua b/apisix/core/config_yaml.lua
index 808daf6..04b450d 100644
--- a/apisix/core/config_yaml.lua
+++ b/apisix/core/config_yaml.lua
@@ -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
diff --git a/apisix/init.lua b/apisix/init.lua
index e35343b..a8d851c 100644
--- a/apisix/init.lua
+++ b/apisix/init.lua
@@ -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
@@ -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