Export RescheduleEligible method for accessibility from UpdateAlloc endpoint

This commit is contained in:
Preetha Appan 2018-01-16 15:01:31 -06:00
parent e2eabffcbd
commit 0a39f213e3
No known key found for this signature in database
GPG key ID: 9F7C19990A50EAFC

View file

@ -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
} }