(r Request)
| 408 | } |
| 409 | |
| 410 | func (s sharder) RoundTrip(r Request) (Responses[combiner.PipelineResponse], error) { |
| 411 | total := 4 |
| 412 | concurrent := 2 |
| 413 | |
| 414 | // execute requests |
| 415 | if s.funcSharder { |
| 416 | return NewAsyncSharderFunc(r.HTTPRequest().Context(), concurrent, total, func(_ int) Request { |
| 417 | return r |
| 418 | }, s.next), nil |
| 419 | } |
| 420 | |
| 421 | reqCh := make(chan Request) |
| 422 | go func() { |
| 423 | for i := 0; i < total; i++ { |
| 424 | reqCh <- r |
| 425 | } |
| 426 | close(reqCh) |
| 427 | }() |
| 428 | return NewAsyncSharderChan(r.HTTPRequest().Context(), concurrent, reqCh, nil, s.next), nil |
| 429 | } |
| 430 | |
| 431 | func BenchmarkNewSyncToAsyncResponse(b *testing.B) { |
| 432 | r := &http.Response{} |
nothing calls this directly
no test coverage detected