Skip to content

Commit

Permalink
Fixed Bug for Waiting Pods Case
Browse files Browse the repository at this point in the history
  • Loading branch information
Shoaeb Jindani committed Oct 13, 2023
1 parent 7e88d12 commit 46932f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/restart/staggerrestarts/staggerrestarts.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ func isOptimizePossible(restartConfig *RestartConfig) bool {
var listOfMspCRName []string
for mspid, queue := range restartConfig.Queues {
for i := 0; i < len(queue); i++ {
// we dont want to consider waiting pods
if queue[i].Status == "waiting" {
continue
}

if util.ContainsValue(mspid+queue[i].CRName, listOfMspCRName) == true {
log.Info(fmt.Sprintf("We Can Optimize Restarts for '%s'", mspid+queue[i].CRName))
canOptimize = true
Expand Down Expand Up @@ -286,8 +291,8 @@ func (s *StaggerRestartsService) Reconcile(componentType, namespace string) (boo
return requeue, err
}

isRestartPossible := isOptimizePossible(restartConfig)
if isRestartPossible {
isOptimizePossibleFlag := isOptimizePossible(restartConfig)
if isOptimizePossibleFlag {
u, err := json.Marshal(restartConfig.Queues)
if err != nil {
panic(err)
Expand Down

0 comments on commit 46932f0

Please sign in to comment.