Skip to content

Commit

Permalink
validating SubNodeDeltaTimestamps based on underlying BitSet
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw committed Dec 4, 2024
1 parent 6893c63 commit 7f00d11
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions flytepropeller/pkg/controller/nodes/array/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 7f00d11

Please sign in to comment.