nic-6443 commented on code in PR #12216:
URL: https://github.com/apache/apisix/pull/12216#discussion_r2101748591


##########
apisix/cli/file.lua:
##########
@@ -293,7 +294,9 @@ function _M.read_yaml_conf(apisix_home)
         end
     end
 
-    if default_conf.deployment.config_provider == "yaml" then
+    --- using `not ngx` to check whether the current execution environment is 
apisix cli module,
+    --- because it is only necessary to parse and validate `apisix.yaml` in 
apisix cli.
+    if default_conf.deployment.config_provider == "yaml" and not ngx then
         local apisix_conf_path = profile:yaml_path("apisix")

Review Comment:
   Yes, it is to optimize execution efficiency because this `read_yaml_conf` 
function is mistakenly called multiple times during the startup of apisix. 
Parsing `apisix.yaml` is very time-consuming, which causes a very slow startup 
when using a large `apisix.yaml`. In fact, the parsing only needs to be 
executed in the apisix cli module(without `ngx` environment).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to