13 lines
717 B
Diff
13 lines
717 B
Diff
--- a/pkg/controller/job/job_controller.go
|
|
+++ b/pkg/controller/job/job_controller.go
|
|
@@ -1354,7 +1354,9 @@ func (jm *Controller) trackJobStatusAndRemoveFinalizers(ctx context.Context, job
|
|
reachedMaxUncountedPods := false
|
|
for _, pod := range jobCtx.pods {
|
|
- if !hasJobTrackingFinalizer(pod) || jobCtx.expectedRmFinalizers.Has(pod.UID) {
|
|
- // This pod was processed in a previous sync.
|
|
+ // Use the already-built uidsWithFinalizer set (O(1)) instead of
|
|
+ // calling hasJobTrackingFinalizer again (O(F) slices.Contains per pod).
|
|
+ if !uidsWithFinalizer.Has(pod.UID) || jobCtx.expectedRmFinalizers.Has(pod.UID) {
|
|
+ // This pod was processed in a previous sync or has no tracking finalizer.
|
|
continue
|
|
}
|