@@ -264,9 +264,6 @@ func (bc *benchmarkClient) unaryLoop(ctx context.Context, conns []*grpc.ClientCo
264264 // Create histogram for each goroutine.
265265 idx := ic * rpcCountPerConn + j
266266 bc .lockingHistograms [idx ].histogram = stats .NewHistogram (bc .histogramOptions )
267- if ctx .Err () != nil {
268- return
269- }
270267 // Start goroutine on the created mutex and histogram.
271268 go func (idx int ) {
272269 // TODO: do warm up if necessary.
@@ -277,7 +274,10 @@ func (bc *benchmarkClient) unaryLoop(ctx context.Context, conns []*grpc.ClientCo
277274 for {
278275 start := time .Now ()
279276 if err := benchmark .DoUnaryCall (ctx , client , reqSize , respSize ); err != nil {
280- return
277+ if status .Code (err ) == codes .Canceled {
278+ return
279+ }
280+ continue
281281 }
282282 elapse := time .Since (start )
283283 bc .lockingHistograms [idx ].add (int64 (elapse ))
@@ -311,9 +311,6 @@ func (bc *benchmarkClient) streamingLoop(ctx context.Context, conns []*grpc.Clie
311311 idx := ic * rpcCountPerConn + j
312312 bc .lockingHistograms [idx ].histogram = stats .NewHistogram (bc .histogramOptions )
313313 if poissonLambda == nil { // Closed loop.
314- if stream .Context ().Err () != nil {
315- return
316- }
317314 // Start goroutine on the created mutex and histogram.
318315 go func (idx int ) {
319316 // TODO: do warm up if necessary.
@@ -342,7 +339,6 @@ func (bc *benchmarkClient) streamingLoop(ctx context.Context, conns []*grpc.Clie
342339func (bc * benchmarkClient ) poissonUnary (ctx context.Context , client testgrpc.BenchmarkServiceClient , idx int , reqSize int , respSize int , lambda float64 ) {
343340 go func () {
344341 start := time .Now ()
345-
346342 if err := benchmark .DoUnaryCall (ctx , client , reqSize , respSize ); err != nil {
347343 return
348344 }
0 commit comments