Skip to content

Commit c52662e

Browse files
authored
Revert "feature: test 1000 concurrent requests at a time (#112)" (#114)
* Revert "feature: test 1000 concurrent requests at a time (#112)"
1 parent 4d58433 commit c52662e

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

client/concurrency.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package main
1717
import (
1818
"fmt"
1919
"log"
20-
"strings"
2120
"sync"
2221
"time"
2322

@@ -124,7 +123,7 @@ func sendConcurrentRequests(sendFn func() error) error {
124123
log.Printf("Single request response time benchmarked, took %s for 1 request", singleReqTime)
125124

126125
// Get a benchmark for the time it takes for concurrent requests
127-
const numConReqs = 1000
126+
const numConReqs = 10
128127
log.Printf("Starting %d concurrent workers to send requests", numConReqs)
129128

130129
type workerResponse struct {
@@ -148,22 +147,19 @@ func sendConcurrentRequests(sendFn func() error) error {
148147
})
149148

150149
maybeErrMessage := ""
151-
first10Workers := []string{}
152150
for i := 0; i < numConReqs; i++ {
153151
resp := <-respCh
154152
if resp.err != nil {
155153
maybeErrMessage += fmt.Sprintf("error #%d: %v\n", i, resp.err)
156-
}
157-
if i < 10 {
158-
first10Workers = append(first10Workers, fmt.Sprintf("Worker #%d", resp.id))
154+
} else {
155+
log.Printf("Worker #%d done", resp.id)
159156
}
160157
}
158+
161159
if maybeErrMessage != "" {
162160
return fmt.Errorf("at least one concurrent request failed:\n%s", maybeErrMessage)
163161
}
164162

165-
log.Printf("First 10 workers done:\n%s", strings.Join(first10Workers, "\n"))
166-
167163
// Validate that the concurrent requests were handled faster than if all
168164
// the requests were handled serially, using the single request time
169165
// as a benchmark. Some buffer is provided by doubling the single request time.

0 commit comments

Comments
 (0)