Wait until all rpcs are done instead of a hard stop.

This commit is contained in:
Adele Zhou
2016-12-28 11:57:08 -08:00
parent 97b8c7c529
commit dd6905b8b2

View File

@ -225,8 +225,6 @@ func performRPCs(gauge *gauge, conn *grpc.ClientConn, selector *weightedRandomTe
var numCalls int64
startTime := time.Now()
for {
done := make(chan bool, 1)
go func() {
test := selector.getNextTest()
switch test {
case "empty_unary":
@ -252,14 +250,13 @@ func performRPCs(gauge *gauge, conn *grpc.ClientConn, selector *weightedRandomTe
case "custom_metadata":
interop.DoCustomMetadata(client, grpc.FailFast(false))
}
done <- true
}()
numCalls++
gauge.set(int64(float64(numCalls) / time.Since(startTime).Seconds()))
select {
case <-stop:
return
case <-done:
numCalls++
gauge.set(int64(float64(numCalls) / time.Since(startTime).Seconds()))
default:
}
}
}