discard invalid action plans

This commit is contained in:
Radu Ioan Fericean
2015-09-30 14:53:01 +03:00
parent 48d76a1e63
commit 6827241d2d
2 changed files with 5 additions and 2 deletions

View File

@@ -297,8 +297,7 @@ func (at *ActionPlan) Execute() (err error) {
func (at *ActionPlan) IsASAP() bool {
if at.Timing == nil {
Logger.Warning(fmt.Sprintf("Nil timing on action plan: %+v, executing ASAP!", at))
return true
return false
}
return at.Timing.Timing.StartTime == utils.ASAP
}

View File

@@ -92,6 +92,10 @@ func (s *Scheduler) LoadActionPlans(storage engine.RatingStorage) {
isAsap := false
newApls := make([]*engine.ActionPlan, 0) // will remove the one time runs from the database
for _, ap := range aps {
if ap.Timing == nil {
Logger.Warning(fmt.Sprintf("Nil timing on action plan: %+v, discarding!", at))
continue
}
isAsap = ap.IsASAP()
toBeSaved = toBeSaved || isAsap
if isAsap {