Skip to content
This repository was archived by the owner on Oct 14, 2020. It is now read-only.

Commit 1010269

Browse files
committed
Optimze code checking for child jobs completions
1 parent e6249db commit 1010269

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

operator/controllers/execution/scan_controller.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,20 +670,16 @@ func (r *ScanReconciler) startPersistenceProvider(scan *executionv1.Scan) error
670670
}
671671

672672
func allJobsCompleted(jobs *batch.JobList) jobCompletionType {
673-
hasFailed := false
674673
hasCompleted := true
675674

676675
for _, job := range jobs.Items {
677676
if job.Status.Failed > 0 {
678-
hasFailed = true
677+
return failed
679678
} else if job.Status.Succeeded == 0 {
680679
hasCompleted = false
681680
}
682681
}
683682

684-
if hasFailed {
685-
return failed
686-
}
687683
if hasCompleted {
688684
return completed
689685
}

0 commit comments

Comments
 (0)