From 3af5184895971950114f41a6820256a502fbcf9f Mon Sep 17 00:00:00 2001 From: Dan Rammer Date: Tue, 13 Dec 2022 12:16:08 -0600 Subject: [PATCH] Fixed nil panic on gate node sleep check (#507) * fixed nil panic on gate node sleep check Signed-off-by: Dan Rammer * lint issue Signed-off-by: Dan Rammer Signed-off-by: Dan Rammer --- flytepropeller/pkg/controller/nodes/gate/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flytepropeller/pkg/controller/nodes/gate/handler.go b/flytepropeller/pkg/controller/nodes/gate/handler.go index 5c6d1a512f..31e21c4dc5 100644 --- a/flytepropeller/pkg/controller/nodes/gate/handler.go +++ b/flytepropeller/pkg/controller/nodes/gate/handler.go @@ -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: