Skip to content

Commit

Permalink
correctly checking ItemsCount
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 c0acaa9 commit 6893c63
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flytepropeller/pkg/controller/nodes/array/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu
arrayNodeState.SubNodeSystemFailures.SetItem(index, uint64(subNodeStatus.GetSystemFailures()))

indexUint := uint(index) // #nosec G115
if arrayNodeState.SubNodeDeltaTimestamps.ItemsCount >= indexUint {
if arrayNodeState.SubNodeDeltaTimestamps.ItemsCount > indexUint {
startedAt := nCtx.NodeStatus().GetLastAttemptStartedAt()
subNodeStartedAt := subNodeStatus.GetLastAttemptStartedAt()
if subNodeStartedAt == nil {
Expand Down Expand Up @@ -794,7 +794,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 arrayNodeState.SubNodeDeltaTimestamps.ItemsCount > subNodeIndexUint {
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 6893c63

Please sign in to comment.