MCPcopy
hub / github.com/cortexlabs/cortex / main

Function main

dev/load.go:78–106  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

76}
77
78func main() {
79 if _numConcurrent > 0 && _requestInterval > 0 {
80 fmt.Println("error: you must set either _numConcurrent or _requestInterval > 0, but not both")
81 os.Exit(1)
82 }
83
84 if _numConcurrent == 0 && _requestInterval == 0 {
85 fmt.Println("error: you must set either _numConcurrent or _requestInterval > 0")
86 os.Exit(1)
87 }
88
89 url, jsonPathOrString := mustExtractArgs()
90 var jsonBytes []byte
91 if jsonPathOrString == "" {
92 jsonBytes = nil
93 } else if strings.HasPrefix(jsonPathOrString, "{") {
94 jsonBytes = []byte(jsonPathOrString)
95 } else {
96 jsonBytes = mustReadJSONBytes(jsonPathOrString)
97 }
98
99 if _numConcurrent > 0 {
100 runConstantInFlight(url, jsonBytes)
101 }
102
103 if _requestInterval > 0 {
104 runConstantRequestsPerSecond(url, jsonBytes)
105 }
106}
107
108func runConstantRequestsPerSecond(url string, jsonBytes []byte) {
109 inFlightCount := Counter{}

Callers

nothing calls this directly

Calls 4

mustExtractArgsFunction · 0.85
mustReadJSONBytesFunction · 0.85
runConstantInFlightFunction · 0.85

Tested by

no test coverage detected