From 1609e6fca65b3bb0ef06d2b0b6d734b75a51b0d0 Mon Sep 17 00:00:00 2001 From: Johnu George Date: Fri, 31 May 2019 14:12:05 +0530 Subject: [PATCH] Skip creating trials if add count is zero --- .../v1alpha2/experiment/experiment_controller.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/pkg/controller/v1alpha2/experiment/experiment_controller.go b/pkg/controller/v1alpha2/experiment/experiment_controller.go index 50b8b7ed4ae..38e44eb36b6 100644 --- a/pkg/controller/v1alpha2/experiment/experiment_controller.go +++ b/pkg/controller/v1alpha2/experiment/experiment_controller.go @@ -331,13 +331,15 @@ func (r *ReconcileExperiment) ReconcileTrials(instance *experimentsv1alpha2.Expe addCount = 0 } - //create "addCount" number of trials - logger.Info("CreateTrials", "addCount", addCount) - if err := r.createTrials(instance, addCount); err != nil { - logger.Error(err, "Create trials error") - return err + //skip if no trials need to be created + if addCount > 0 { + //create "addCount" number of trials + logger.Info("CreateTrials", "addCount", addCount) + if err := r.createTrials(instance, addCount); err != nil { + logger.Error(err, "Create trials error") + return err + } } - } return nil