this function runs an number of heavyRequests using goroutines then waits that all the requests are currently handled by the fakeServer
(p *reverseProxy, nbHeavyRequest int64, shouldWait bool)
| 1301 | // this function runs an number of heavyRequests using goroutines |
| 1302 | // then waits that all the requests are currently handled by the fakeServer |
| 1303 | func runHeavyRequestInGoroutine(p *reverseProxy, nbHeavyRequest int64, shouldWait bool) { |
| 1304 | atomic.StoreInt64(&nbHeavyRequestsInflight, 0) |
| 1305 | for i := 0; i < int(nbHeavyRequest); i++ { |
| 1306 | go makeHeavyRequest(p, heavyRequestDuration) |
| 1307 | } |
| 1308 | counter := 0 |
| 1309 | //we wait up to 200 msec for the requests to be handled by the fakeServer because |
| 1310 | // the code on github actions can be very slow |
| 1311 | for shouldWait && atomic.LoadInt64(&nbHeavyRequestsInflight) < nbHeavyRequest && counter < 200 { |
| 1312 | time.Sleep(time.Millisecond) |
| 1313 | counter++ |
| 1314 | } |
| 1315 | } |
| 1316 | |
| 1317 | func stopAllRequestsInFlight() { |
| 1318 | atomic.StoreUint64(&shouldStop, 1) |
no test coverage detected