fix integer divide by zero panic

This commit is contained in:
Guoliang Wang 2018-06-09 09:26:19 +08:00
parent c46e8a9248
commit 2417f95308

View File

@ -162,8 +162,12 @@ func schedulePods(config *testConfig) int32 {
// return the worst-case-scenario interval that was seen during this time.
// Note this should never be low due to cold-start, so allow bake in sched time if necessary.
if len(scheduled) >= config.numPods {
consumed := int(time.Since(start) / time.Second)
if consumed <= 0 {
consumed = 1
}
fmt.Printf("Scheduled %v Pods in %v seconds (%v per second on average). min QPS was %v\n",
config.numPods, int(time.Since(start)/time.Second), config.numPods/int(time.Since(start)/time.Second), minQps)
config.numPods, consumed, config.numPods/consumed, minQps)
return minQps
}