You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/12 02:23:31 UTC

[GitHub] [apisix] tokers commented on a change in pull request #4559: feat: Request-ID plugin add snowflake algorithm

tokers commented on a change in pull request #4559:
URL: https://github.com/apache/apisix/pull/4559#discussion_r667579814



##########
File path: apisix/plugins/request-id.lua
##########
@@ -41,9 +72,134 @@ function _M.check_schema(conf)
 end
 
 
+-- Generates the current process worker number
+local function gen_worker_number(max_number)
+    if worker_number == nil then
+        local etcd_cli, prefix = core.etcd.new()
+        local prefix = prefix .. "/plugins/request-id/snowflake/"
+        local uuid = uuid.generate_v4()
+        local id = 1
+        while (id <= max_number) do
+            ::continue::
+            local res, _ = etcd_cli:grant(attr.snowflake.worker_number_ttl)

Review comment:
       I am afraid that we shouldn't ignore this error.




-- 
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-unsubscribe@apisix.apache.org

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