tokers commented on issue #3229:
URL: https://github.com/apache/apisix/issues/3229#issuecomment-757102595


   @HelloBug0 
   
   > I searched self.running in the whole project, and there is one function 
named _M.close that set this variable to false and one function named _M.new 
that set this variable to true. I didn't see anywhere where call _M.close. So 
here is the question, what's the purpose of this variable?
   
   I don't know the precise answer, but i think it's for the sake of 
extensibility.
   
   > Why do we use cycle here if we will call the function again here after the 
cycle?
   If we have a strong reason to use cycle, why is the cycle times 32(i <= 32)
   
   In OpenResty, `ngx.timer` is implemented by created a fake request, which 
has it's own memory pool, and is somewhat heavy, considering the memory pool's 
mechanism (it only backs memory to OS when request is destroyed), we cannot let 
a timer handler running too long, while if we only run only once, it's in turn 
wasteful, so here `32`, which is an empirical value as the cycle length, is 
suitable.


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