From d47547e64f270e3586ca3a70350c89175762624d Mon Sep 17 00:00:00 2001 From: Paul Dittamo Date: Wed, 5 Jun 2024 22:58:56 -0700 Subject: [PATCH] reset taskPhaseVersion due to nodephase change after emitting event Signed-off-by: Paul Dittamo --- flytepropeller/pkg/controller/nodes/array/handler.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flytepropeller/pkg/controller/nodes/array/handler.go b/flytepropeller/pkg/controller/nodes/array/handler.go index 0f9e95f19b..cdf77e1875 100644 --- a/flytepropeller/pkg/controller/nodes/array/handler.go +++ b/flytepropeller/pkg/controller/nodes/array/handler.go @@ -576,11 +576,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 } @@ -588,6 +585,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