membphis commented on pull request #2357:
URL: https://github.com/apache/apisix/pull/2357#issuecomment-703379020


   > why only `init` phase is not enough?
   
   `init` works in `master` process if the 
[lua_code_cache](https://github.com/openresty/lua-nginx-module#lua_code_cache) 
is `on`.
   
   We want to set different `seed` for different work processes, so we should 
use `init_worker` phase.
   
   we can delete those code 
https://github.com/apache/apisix/pull/2357/files#diff-d982d52466e7c93c7b604358339b2a29R85-R90
 . 
   And run the test case, then we will get the same random number which is 
wrong.
   
   
![image](https://user-images.githubusercontent.com/6814606/95037817-dc27fc80-06fe-11eb-8d74-160d68ebf022.png)
   
   Here is the right one:
   
   
![image](https://user-images.githubusercontent.com/6814606/95037874-1db8a780-06ff-11eb-8b5c-e79016eb441b.png)
   
   
   
![image](https://user-images.githubusercontent.com/6814606/95037656-43917c80-06fe-11eb-8444-f00a930cac9b.png)
   


----------------------------------------------------------------
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:
[email protected]


Reply via email to