Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

Commit e13b822

Browse files
authored
Remove unnecessary recoverFrameworkWorkItems (#38)
1 parent 4a771cd commit e13b822

File tree

1 file changed

+5
-36
lines changed

1 file changed

+5
-36
lines changed

pkg/controller/controller.go

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,11 @@ func (c *FrameworkController) syncFramework(key string) (returnedErr error) {
531531
if f.Status != nil {
532532
// Recover f related things, since it is the first time we see it and
533533
// its Status is not nil.
534-
c.recoverFrameworkWorkItems(f)
534+
// No need to recover previous enqueued items, because the Informer has
535+
// already delivered the Add events for all recovered Frameworks which
536+
// caused all Frameworks will be enqueued to sync.
537+
// No need to recover previous scheduled to enqueue items, because the
538+
// schedule will be recovered during sync.
535539
}
536540

537541
// f.Status must be the same as the remote one, since it is the first
@@ -582,41 +586,6 @@ func (c *FrameworkController) syncFramework(key string) (returnedErr error) {
582586
}
583587
}
584588

585-
// No need to recover the non-AddAfter items, because the Informer has already
586-
// delivered the Add events for all recovered Frameworks which caused all
587-
// Frameworks will be enqueued to sync.
588-
func (c *FrameworkController) recoverFrameworkWorkItems(f *ci.Framework) {
589-
logPfx := fmt.Sprintf("[%v]: recoverFrameworkWorkItems: ", f.Key())
590-
klog.Infof(logPfx + "Started")
591-
defer func() { klog.Infof(logPfx + "Completed") }()
592-
593-
if f.Status == nil {
594-
return
595-
}
596-
597-
c.recoverTimeoutChecks(f)
598-
}
599-
600-
func (c *FrameworkController) recoverTimeoutChecks(f *ci.Framework) {
601-
// If a check is already timeout, the timeout will be handled by the following
602-
// sync after the recover, so no need to enqueue it again.
603-
if f.Status.State == ci.FrameworkCompleted {
604-
c.enqueueFrameworkCompletedRetainTimeoutCheck(f, true)
605-
return
606-
}
607-
c.enqueueFrameworkAttemptCreationTimeoutCheck(f, true)
608-
c.enqueueFrameworkRetryDelayTimeoutCheck(f, true)
609-
610-
for _, taskRoleStatus := range f.TaskRoleStatuses() {
611-
for _, taskStatus := range taskRoleStatus.TaskStatuses {
612-
taskRoleName := taskRoleStatus.Name
613-
taskIndex := taskStatus.Index
614-
c.enqueueTaskAttemptCreationTimeoutCheck(f, taskRoleName, taskIndex, true)
615-
c.enqueueTaskRetryDelayTimeoutCheck(f, taskRoleName, taskIndex, true)
616-
}
617-
}
618-
}
619-
620589
func (c *FrameworkController) enqueueFrameworkCompletedRetainTimeoutCheck(
621590
f *ci.Framework, failIfTimeout bool) bool {
622591
if f.Status.State != ci.FrameworkCompleted {

0 commit comments

Comments
 (0)