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

Method requestWithContext

pkg/proxy/breaker_test.go:371–379  ·  view source on GitHub ↗

requestWithContext simulates a request in a separate goroutine. The request will either fail immediately (as observable via expectFailure) or block until processSuccessfully is called.

(ctx context.Context)

Source from the content-addressed store, hash-verified

369// request will either fail immediately (as observable via expectFailure)
370// or block until processSuccessfully is called.
371func (r *requestor) requestWithContext(ctx context.Context) {
372 go func() {
373 err := r.breaker.Maybe(ctx, func() {
374 r.InProgress.Inc()
375 <-r.barrierCh
376 })
377 r.acceptedCh <- err == nil
378 }()
379}
380
381// expectFailure waits for a request to finish and asserts it to be failed.
382func (r *requestor) expectFailure(t *testing.T) {

Callers 2

requestMethod · 0.95
TestBreakerCancelFunction · 0.80

Calls 1

MaybeMethod · 0.80

Tested by

no test coverage detected