Export RescheduleEligible method for accessibility from UpdateAlloc endpoint
This commit is contained in:
parent
e2eabffcbd
commit
0a39f213e3
|
@ -5134,18 +5134,23 @@ func (a *Allocation) ShouldReschedule(reschedulePolicy *ReschedulePolicy) bool {
|
||||||
return false
|
return false
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
if reschedulePolicy == nil {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
switch a.ClientStatus {
|
switch a.ClientStatus {
|
||||||
case AllocClientStatusFailed:
|
case AllocClientStatusFailed:
|
||||||
return a.rescheduleEligible(reschedulePolicy.Interval, reschedulePolicy.Attempts)
|
return a.RescheduleEligible(reschedulePolicy)
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Allocation) rescheduleEligible(interval time.Duration, attempts int) bool {
|
// RescheduleEligible returns if the allocation is eligible to be rescheduled according
|
||||||
|
// to its ReschedulePolicy and the current state of its reschedule trackers
|
||||||
|
func (a *Allocation) RescheduleEligible(reschedulePolicy *ReschedulePolicy) bool {
|
||||||
|
if reschedulePolicy == nil {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
attempts := reschedulePolicy.Attempts
|
||||||
|
interval := reschedulePolicy.Interval
|
||||||
|
|
||||||
if attempts == 0 {
|
if attempts == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue