Skip to content

Commit

Permalink
fix: use FinishedAt
Browse files Browse the repository at this point in the history
Signed-off-by: isubasinghe <[email protected]>
  • Loading branch information
isubasinghe committed Oct 28, 2024
1 parent 96282c7 commit 47e9ee1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions workflow/controller/taskresult.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (wfc *WorkflowController) newWorkflowTaskResultInformer() cache.SharedIndex
}

func recentlyDeleted(node *wfv1.NodeStatus) bool {
return time.Since(node.StartedAt.Time) <= envutil.LookupEnvDurationOr("RECENTLY_DELETED_POD_DURATION", 2*time.Minute)
return time.Since(node.FinishedAt.Time) <= envutil.LookupEnvDurationOr("RECENTLY_DELETED_POD_DURATION", 2*time.Minute)
}

func (woc *wfOperationCtx) taskResultReconciliation() {
Expand Down Expand Up @@ -86,7 +86,7 @@ func (woc *wfOperationCtx) taskResultReconciliation() {
}

// Mark task result as completed if it has no chance to be completed.
if label == "false" && !woc.nodePodExist(*old) {
if label == "false" && old.Completed() && !woc.nodePodExist(*old) {
if recentlyDeleted(old) {
woc.log.WithField("nodeID", nodeID).Debug("Wait for marking task result as completed because pod is recently deleted.")
// If the pod was deleted, then it is possible that the controller never get another informer message about it.
Expand Down

0 comments on commit 47e9ee1

Please sign in to comment.