Skip to content

Commit f771884

Browse files
committed
Move checking for Failure action
Move error handling directly after NextAction call instead of deferring it until later in the reconcile flow. This prevents executing unnecessary operations when NextAction has already failed.
1 parent f415cd9 commit f771884

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/controller/common_controller.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ func CommonReconcile[T TestResource](
180180
}
181181

182182
nextAction, workflowStepIndex, err := r.NextAction(ctx, instance, workflowLength)
183+
if nextAction == Failure {
184+
return ctrl.Result{}, err
185+
}
183186

184187
// Apply workflow step overrides to the base spec
185188
if config.SupportsWorkflow && workflowStepIndex < workflowLength {
@@ -200,9 +203,6 @@ func CommonReconcile[T TestResource](
200203
}
201204

202205
switch nextAction {
203-
case Failure:
204-
return ctrl.Result{}, err
205-
206206
case Wait:
207207
Log.Info(InfoWaitingOnPod)
208208
return ctrl.Result{RequeueAfter: RequeueAfterValue}, nil

0 commit comments

Comments
 (0)