From 7f00d114580de5920f6023ea826772b80b0761d1 Mon Sep 17 00:00:00 2001 From: Daniel Rammer Date: Wed, 4 Dec 2024 15:07:43 -0600 Subject: [PATCH] validating SubNodeDeltaTimestamps based on underlying BitSet Signed-off-by: Daniel Rammer --- flytepropeller/pkg/controller/nodes/array/handler.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/flytepropeller/pkg/controller/nodes/array/handler.go b/flytepropeller/pkg/controller/nodes/array/handler.go index b286e9ba36..51d3105a0a 100644 --- a/flytepropeller/pkg/controller/nodes/array/handler.go +++ b/flytepropeller/pkg/controller/nodes/array/handler.go @@ -389,8 +389,7 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu arrayNodeState.SubNodeRetryAttempts.SetItem(index, uint64(subNodeStatus.GetAttempts())) arrayNodeState.SubNodeSystemFailures.SetItem(index, uint64(subNodeStatus.GetSystemFailures())) - indexUint := uint(index) // #nosec G115 - if arrayNodeState.SubNodeDeltaTimestamps.ItemsCount > indexUint { + if arrayNodeState.SubNodeDeltaTimestamps.BitSet != nil { startedAt := nCtx.NodeStatus().GetLastAttemptStartedAt() subNodeStartedAt := subNodeStatus.GetLastAttemptStartedAt() if subNodeStartedAt == nil { @@ -793,8 +792,7 @@ func (a *arrayNodeHandler) buildArrayNodeContext(ctx context.Context, nCtx inter // compute start time for subNode using delta timestamp from ArrayNode NodeStatus var startedAt *metav1.Time - subNodeIndexUint := uint(subNodeIndex) // #nosec G115 - if arrayNodeState.SubNodeDeltaTimestamps.ItemsCount > subNodeIndexUint { + if nCtx.NodeStatus().GetLastAttemptStartedAt() != nil && arrayNodeState.SubNodeDeltaTimestamps.BitSet != nil { if deltaSeconds := arrayNodeState.SubNodeDeltaTimestamps.GetItem(subNodeIndex); deltaSeconds != 0 { startedAt = &metav1.Time{Time: nCtx.NodeStatus().GetLastAttemptStartedAt().Add(time.Duration(deltaSeconds) * time.Second)} // #nosec G115 }