[GitHub] [apisix] tokers commented on a change in pull request #4183: feat(ext-plugin): implement the http-req-call protocol

2021-05-05 Thread GitBox


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



##
File path: apisix/plugins/ext-plugin/init.lua
##
@@ -152,6 +165,80 @@ end
 _M.receive = receive
 
 
+local generate_id
+do
+local count = 0
+local MAX_COUNT = lshift(1, 22)
+
+function generate_id()
+local wid = worker_id()
+local id = lshift(wid, 22) + count
+count = count + 1
+if count == MAX_COUNT then
+count = 0

Review comment:
   OK.




-- 
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.

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




[GitHub] [apisix] tokers commented on a change in pull request #4183: feat(ext-plugin): implement the http-req-call protocol

2021-05-05 Thread GitBox


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



##
File path: apisix/plugins/ext-plugin/init.lua
##
@@ -152,6 +165,80 @@ end
 _M.receive = receive
 
 
+local generate_id
+do
+local count = 0
+local MAX_COUNT = lshift(1, 22)
+
+function generate_id()
+local wid = worker_id()
+local id = lshift(wid, 22) + count
+count = count + 1
+if count == MAX_COUNT then
+count = 0

Review comment:
   Does the id rotate will influence the correctness?




-- 
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.

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