nic-6443 commented on code in PR #13904:
URL: https://github.com/apache/apisix/pull/13904#discussion_r3910408929
##########
apisix/admin/standalone.lua:
##########
@@ -64,19 +84,82 @@ local function update_and_broadcast_config(apisix_yaml)
if shared_dict then
-- the worker that handles Admin API calls is responsible for writing
the shared dict
- local ok, err = shared_dict:set("config", raw)
+ local stored = config_yaml.encode_config(apisix_yaml[METADATA_DIGEST],
raw)
+ local ok, err = shared_dict:set("config", stored)
if not ok then
return nil, "failed to save config to shared dict: " .. err
end
core.log.info("standalone config updated: ", raw)
else
core.log.crit(config_yaml.ERR_NO_SHARED_DICT)
end
- return events:post(EVENT_UPDATE, EVENT_UPDATE)
+ return true
end
local validate_configuration = config_validate.validate_configuration
+
+local MAX_WAIT_MS = 60000
+local POLL_INTERVAL = 0.05
+
+
+local function parse_wait_ms(ctx)
+ local args = core.request.get_uri_args(ctx)
+ local wait = args and tonumber(args.wait)
+ if not wait or wait <= 0 then
+ return 0
+ end
+ if wait > MAX_WAIT_MS then
+ return MAX_WAIT_MS
+ end
+ return wait
+end
+
+
+local is_stream_enabled
+local function stream_enabled()
+ if is_stream_enabled ~= nil then
+ return is_stream_enabled
+ end
+ local local_conf = core.config.local_conf()
+ local proxy_mode = local_conf and local_conf.apisix and
local_conf.apisix.proxy_mode
+ is_stream_enabled = proxy_mode ~= nil and str_find(proxy_mode, "stream",
1, true) ~= nil
+ return is_stream_enabled
+end
Review Comment:
How about putting this piece of code into the `core.config.local_conf`
module? I've noticed this code is duplicated in several places.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]