MCPcopy Index your code
hub / github.com/cortexlabs/cortex / runConstantRequestsPerSecondIteration

Function runConstantRequestsPerSecondIteration

dev/load.go:137–160  ·  view source on GitHub ↗
(url string, jsonBytes []byte, inFlightCount *Counter, done chan bool)

Source from the content-addressed store, hash-verified

135}
136
137func runConstantRequestsPerSecondIteration(url string, jsonBytes []byte, inFlightCount *Counter, done chan bool) {
138 if _maxInFlight > 0 {
139 inFlightCount.Lock()
140 if inFlightCount.count >= _maxInFlight {
141 inFlightCount.Unlock()
142 fmt.Printf("\nreached max in-flight (%d)\n", _maxInFlight)
143 return
144 }
145 inFlightCount.count++
146 inFlightCount.Unlock()
147 }
148
149 makeRequest(url, jsonBytes)
150
151 if _numRequests > 0 && _requestCount.Load() >= _numRequests {
152 done <- true
153 }
154
155 if _maxInFlight > 0 {
156 inFlightCount.Lock()
157 inFlightCount.count--
158 inFlightCount.Unlock()
159 }
160}
161
162func runConstantInFlight(url string, jsonBytes []byte) {
163 if _numRequestsPerThread > 0 {

Callers 1

Calls 1

makeRequestFunction · 0.85

Tested by

no test coverage detected