Skip to content

Commit

Permalink
Fixed nil panic on gate node sleep check (flyteorg#507)
Browse files Browse the repository at this point in the history
* fixed nil panic on gate node sleep check

Signed-off-by: Dan Rammer <[email protected]>

* lint issue

Signed-off-by: Dan Rammer <[email protected]>

Signed-off-by: Dan Rammer <[email protected]>
  • Loading branch information
hamersaw authored Dec 13, 2022
1 parent 6242e63 commit 3af5184
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions flytepropeller/pkg/controller/nodes/gate/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ func (g *gateNodeHandler) Handle(ctx context.Context, nCtx handler.NodeExecution
sleepDuration := sleepCondition.GetDuration().AsDuration()

// check duration of node sleep
now := time.Now()
if sleepDuration <= now.Sub(nCtx.NodeStatus().GetLastAttemptStartedAt().Time) {
lastAttemptStartedAt := nCtx.NodeStatus().GetLastAttemptStartedAt()
if lastAttemptStartedAt != nil && sleepDuration <= time.Since(lastAttemptStartedAt.Time) {
return handler.DoTransition(handler.TransitionTypeEphemeral, handler.PhaseInfoSuccess(&handler.ExecutionInfo{})), nil
}
default:
Expand Down

0 comments on commit 3af5184

Please sign in to comment.