diff --git a/clusterloader2/pkg/measurement/common/wait_for_controlled_pods.go b/clusterloader2/pkg/measurement/common/wait_for_controlled_pods.go index a6eee2aceb..0753fa015b 100644 --- a/clusterloader2/pkg/measurement/common/wait_for_controlled_pods.go +++ b/clusterloader2/pkg/measurement/common/wait_for_controlled_pods.go @@ -615,10 +615,10 @@ func (w *waitForControlledPodsRunningMeasurement) waitForRuntimeObject(obj runti o := newObjectChecker(key) o.lock.Lock() defer o.lock.Unlock() + ctx, cancel := context.WithCancel(ctx) + o.cancel = cancel w.handlingGroup.Start(func() { - ctx, cancel := context.WithCancel(ctx) defer cancel() - o.SetCancel(cancel) if operationTimeout != time.Duration(0) { ctx, cancel = context.WithTimeout(ctx, operationTimeout) defer cancel()