diff --git a/flytepropeller/pkg/controller/nodes/array/handler.go b/flytepropeller/pkg/controller/nodes/array/handler.go index 5e571a0c48..315041cb51 100644 --- a/flytepropeller/pkg/controller/nodes/array/handler.go +++ b/flytepropeller/pkg/controller/nodes/array/handler.go @@ -577,11 +577,8 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu taskPhase = idlcore.TaskExecution_FAILED } - // if the ArrayNode phase has changed we need to reset the taskPhaseVersion to 0, otherwise - // increment it if we detect any changes in subNode state. - if currentArrayNodePhase != arrayNodeState.Phase { - arrayNodeState.TaskPhaseVersion = 0 - } else if incrementTaskPhaseVersion { + // increment taskPhaseVersion if we detect any changes in subNode state. + if incrementTaskPhaseVersion { arrayNodeState.TaskPhaseVersion = arrayNodeState.TaskPhaseVersion + 1 } @@ -589,6 +586,11 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu logger.Errorf(ctx, "ArrayNode event recording failed: [%s]", err.Error()) return handler.UnknownTransition, err } + + // if the ArrayNode phase has changed we need to reset the taskPhaseVersion to 0 + if currentArrayNodePhase != arrayNodeState.Phase { + arrayNodeState.TaskPhaseVersion = 0 + } } // update array node status