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 2020/03/04 08:03:56 UTC

[GitHub] [incubator-apisix] sshniro commented on issue #1189: request help: How to implement thread sleep in Nginx Test

sshniro commented on issue #1189: request help: How to implement thread sleep in Nginx Test
URL: https://github.com/apache/incubator-apisix/issues/1189#issuecomment-594379479
 
 
   I would like to write a test case to test the inactive timeout. The following are the configurations.
   - Inactive Timeout = 2 S
   - Batch Max Size = 100
   
   ![image](https://user-images.githubusercontent.com/13045528/75857387-72f1ab00-5df6-11ea-9a34-93cfb62db54c.png)
   
   I would like to push an entry to the buffer at 0s and wait till 2s and push another entry. In this manner, I can reach the line segment of the code block[extending buffer timer]. To achieve this I need to wait for 2s before pushing the next entry to the buffer in the test case.
   
   I've tried this solution but unfortunately, it does not work as expected.
   ```lua
   require "socket"
   
   function sleep(sec)
       socket.select(nil, nil, sec)
   end
   
   sleep(2)
   ```
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services