Merge pull request #920 from apolcyn/remove_extra_goroutine_in_benchmark_clients
Remove extra goroutine in benchmark clients
This commit is contained in:
@ -317,28 +317,17 @@ func (bc *benchmarkClient) doCloseLoopStreaming(conns []*grpc.ClientConn, rpcCou
|
|||||||
// Now relying on worker client to reserve time to do warm up.
|
// Now relying on worker client to reserve time to do warm up.
|
||||||
// The worker client needs to wait for some time after client is created,
|
// The worker client needs to wait for some time after client is created,
|
||||||
// before starting benchmark.
|
// before starting benchmark.
|
||||||
done := make(chan bool)
|
|
||||||
for {
|
for {
|
||||||
go func() {
|
start := time.Now()
|
||||||
start := time.Now()
|
if err := doRPC(stream, reqSize, respSize); err != nil {
|
||||||
if err := doRPC(stream, reqSize, respSize); err != nil {
|
return
|
||||||
select {
|
}
|
||||||
case <-bc.stop:
|
elapse := time.Since(start)
|
||||||
case done <- false:
|
bc.lockingHistograms[idx].add(int64(elapse))
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
elapse := time.Since(start)
|
|
||||||
bc.lockingHistograms[idx].add(int64(elapse))
|
|
||||||
select {
|
|
||||||
case <-bc.stop:
|
|
||||||
case done <- true:
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
select {
|
select {
|
||||||
case <-bc.stop:
|
case <-bc.stop:
|
||||||
return
|
return
|
||||||
case <-done:
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}(idx)
|
}(idx)
|
||||||
|
Reference in New Issue
Block a user