dickens7 commented on a change in pull request #4559:
URL: https://github.com/apache/apisix/pull/4559#discussion_r667345377
##########
File path: apisix/plugins/request-id.lua
##########
@@ -65,4 +191,47 @@ function _M.header_filter(conf, ctx)
end
end
+function _M.init()
+ local local_conf = core.config.local_conf()
+ attr = core.table.try_read_attr(local_conf, "plugin_attr", plugin_name)
+ local ok, err = core.schema.check(attr_schema, attr)
+ if not ok then
+ core.log.error("failed to check the plugin_attr[", plugin_name, "]",
": ", err)
+ return
+ end
+ if attr.snowflake.enable then
+ if process.type() == "worker" then
+ ngx.timer.at(0, next_id)
+ end
+ end
+end
+
+function _M.api()
Review comment:
The API is exposed to make it a global ID generator. The real
applicatipon may require multiple ID while the request-id can only be passed to
one proxy application.If there is a concern about the exposing of the
algorithm mechanism, I can implement it in other way, such as, registering a
specific route and configure the request-id plugin.
--
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]