separete sleep func

This commit is contained in:
YamasouA 2025-02-13 23:46:43 +09:00
parent 6d291ddc21
commit ca8a0f5f1b

View File

@ -1553,10 +1553,7 @@ func runWorkload(tCtx ktesting.TContext, tc *testCase, w *workload, informerFact
case *barrierOp:
executor.runBarrierOp(opIndex, concreteOp)
case *sleepOp:
select {
case <-tCtx.Done():
case <-time.After(concreteOp.Duration.Duration):
}
executor.runSleepOp(concreteOp)
case *startCollectingMetricsOp:
executor.runStartCollectingMetricsOp(opIndex, concreteOp)
defer (*executor.collectorCtx).Cancel("cleaning up")
@ -1640,6 +1637,13 @@ func (e *WorkloadExecutor) runBarrierOp(opIndex int, op *barrierOp) {
}
}
func (e *WorkloadExecutor) runSleepOp(op *sleepOp) {
select {
case <-(*e.tCtx).Done():
case <-time.After(op.Duration.Duration):
}
}
func (e *WorkloadExecutor) runStopCollectingMetrics(opIndex int) {
items := stopCollectingMetrics(*e.tCtx, *e.collectorCtx, e.collectorWG, e.workload.Threshold, *e.workload.ThresholdMetricSelector, opIndex, e.collectors)
e.dataItems = append(e.dataItems, items...)