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
1 changed files with 10 additions and 5 deletions

View File

@ -5134,18 +5134,23 @@ func (a *Allocation) ShouldReschedule(reschedulePolicy *ReschedulePolicy) bool {
return false
default:
}
if reschedulePolicy == nil {
return false
}
switch a.ClientStatus {
case AllocClientStatusFailed:
return a.rescheduleEligible(reschedulePolicy.Interval, reschedulePolicy.Attempts)
return a.RescheduleEligible(reschedulePolicy)
default:
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 {
return false
}