use build-in max and min func to instead of k8s.io/utils/integer funcs
Kubernetes-commit: eb8f3f194fed16484162aebdaab69168e02f8cb4
This commit is contained in:
parent
78157c73d3
commit
febd537a31
|
@ -44,17 +44,3 @@ func hasPathPrefix(s, pathPrefix string) bool {
|
|||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func max(a, b int) int {
|
||||
if a > b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func min(a, b int) int {
|
||||
if a < b {
|
||||
return a
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
|
@ -792,11 +792,11 @@ func (qs *queueSet) findDispatchQueueToBoundLocked() (*queue, *request) {
|
|||
queue := qs.queues[qs.robinIndex]
|
||||
oldestWaiting, _ := queue.requestsWaiting.Peek()
|
||||
if oldestWaiting != nil {
|
||||
sMin = ssMin(sMin, queue.nextDispatchR)
|
||||
sMax = ssMax(sMax, queue.nextDispatchR)
|
||||
sMin = min(sMin, queue.nextDispatchR)
|
||||
sMax = max(sMax, queue.nextDispatchR)
|
||||
estimatedWorkInProgress := fqrequest.SeatsTimesDuration(float64(queue.seatsInUse), qs.estimatedServiceDuration)
|
||||
dsMin = ssMin(dsMin, queue.nextDispatchR-estimatedWorkInProgress)
|
||||
dsMax = ssMax(dsMax, queue.nextDispatchR-estimatedWorkInProgress)
|
||||
dsMin = min(dsMin, queue.nextDispatchR-estimatedWorkInProgress)
|
||||
dsMax = max(dsMax, queue.nextDispatchR-estimatedWorkInProgress)
|
||||
currentVirtualFinish := queue.nextDispatchR + oldestWaiting.totalWork()
|
||||
klog.V(11).InfoS("Considering queue to dispatch", "queueSet", qs.qCfg.Name, "queue", qs.robinIndex, "finishR", currentVirtualFinish)
|
||||
if currentVirtualFinish < minVirtualFinish {
|
||||
|
@ -848,20 +848,6 @@ func (qs *queueSet) findDispatchQueueToBoundLocked() (*queue, *request) {
|
|||
return minQueue, oldestReqFromMinQueue
|
||||
}
|
||||
|
||||
func ssMin(a, b fqrequest.SeatSeconds) fqrequest.SeatSeconds {
|
||||
if a > b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
func ssMax(a, b fqrequest.SeatSeconds) fqrequest.SeatSeconds {
|
||||
if a < b {
|
||||
return b
|
||||
}
|
||||
return a
|
||||
}
|
||||
|
||||
// finishRequestAndDispatchAsMuchAsPossible is a convenience method
|
||||
// which calls finishRequest for a given request and then dispatches
|
||||
// as many requests as possible. This is all of what needs to be done
|
||||
|
|
Loading…
Reference in New Issue