Fix TestLimitConcurrency_queueWaitTimeRealTimeout flake
For #5622 (closed)
Similar to the flake in #5601 (closed), this flake is caused by the low timeout of the concurrency limiter.
This test setups two requests:
- The first one is eligible. It enters the handler and blocks the queue.
- The second request is blocked until timeout.
Both of them share this timeout. Internally, the limiter creates a context deadline to reject timed-out requests. If it's set too low, there's a tiny possibility that the context reaches the deadline when the limiter checks the request. Thus, setting a reasonable timeout here and adding some retry attempts below make the test stable.
Although this test can use a mock function, the whole purpose of the test is to verify the code works with a real timeout. Other tests in the same file use the timeout mock extensively already. So, it would be nicer if we can adjust the timeout.
Edited by Quang-Minh Nguyen