From 7a2ffe100d8f9b234882e030b83247d208fe55b9 Mon Sep 17 00:00:00 2001 From: Johnu George Date: Fri, 31 May 2019 14:54:25 +0530 Subject: [PATCH] Skip creating trials if add count is zero (#617) --- .../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