Refresh Timestamp when pod is not present in the three sub-queues

The pInfo.Timestamp is refreshed but the sort in activeQ or podBackoffQ is not be updated when pod  is already present in the backoff or active queue.
AddUnschedulableIfNotPresent() return error if pod is already present in the backoff or active queue, and there is no re-add.
So  refresh  pInfo.Timestamp when  the pod is not present in the three sub-queues, otherwise need to update the order of the pod in the active or backoff queue, for example p.activeQ.Update(pInfo)
This commit is contained in:
jindezgm
2020-12-14 22:39:08 +08:00
committed by GitHub
parent bd4d197b52
commit 5e6177897d

View File

@@ -302,14 +302,15 @@ func (p *PriorityQueue) AddUnschedulableIfNotPresent(pInfo *framework.QueuedPodI
return fmt.Errorf("pod: %v is already present in unschedulable queue", nsNameForPod(pod))
}
// Refresh the timestamp since the pod is re-added.
pInfo.Timestamp = p.clock.Now()
if _, exists, _ := p.activeQ.Get(pInfo); exists {
return fmt.Errorf("pod: %v is already present in the active queue", nsNameForPod(pod))
}
if _, exists, _ := p.podBackoffQ.Get(pInfo); exists {
return fmt.Errorf("pod %v is already present in the backoff queue", nsNameForPod(pod))
}
// Refresh the timestamp since the pod is re-added.
pInfo.Timestamp = p.clock.Now()
// If a move request has been received, move it to the BackoffQ, otherwise move
// it to unschedulableQ.