From 52d8cecd12976c6f2f9d1ef8e568f822f6ea00cc Mon Sep 17 00:00:00 2001 From: Radu Ioan Fericean Date: Tue, 29 Sep 2015 09:36:38 +0300 Subject: [PATCH] improved scheduler logs --- engine/action_plan.go | 11 ++++++----- scheduler/scheduler.go | 5 ----- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/engine/action_plan.go b/engine/action_plan.go index 689cafc5a..29386c76a 100644 --- a/engine/action_plan.go +++ b/engine/action_plan.go @@ -93,7 +93,7 @@ func (at *ActionPlan) GetNextStartTimeOld(now time.Time) (t time.Time) { var err error t, err = time.Parse(FORMAT, l) if err != nil { - Logger.Err(fmt.Sprintf("Cannot parse action timing's StartTime %v", l)) + Logger.Err(fmt.Sprintf("Cannot parse action plan's StartTime %v", l)) at.stCache = t return } @@ -258,7 +258,7 @@ func (at *ActionPlan) Execute() (err error) { return 0, nil }, 0, accId) if err != nil { - Logger.Warning(fmt.Sprintf("Error executing action timing: %v", err)) + Logger.Warning(fmt.Sprintf("Error executing action plan: %v", err)) } } continue // do not go to getActionFunc @@ -266,7 +266,7 @@ func (at *ActionPlan) Execute() (err error) { actionFunction, exists := getActionFunc(a.ActionType) if !exists { - // do not allow the action timing to be rescheduled + // do not allow the action plan to be rescheduled at.Timing = nil Logger.Crit(fmt.Sprintf("Function type %v not available, aborting execution!", a.ActionType)) return @@ -287,7 +287,7 @@ func (at *ActionPlan) Execute() (err error) { return 0, nil }, 0, accId) if err != nil { - Logger.Warning(fmt.Sprintf("Error executing action timing: %v", err)) + Logger.Warning(fmt.Sprintf("Error executing action plan: %v", err)) } } } @@ -297,7 +297,8 @@ func (at *ActionPlan) Execute() (err error) { func (at *ActionPlan) IsASAP() bool { if at.Timing == nil { - return false + Logger.Warning(fmt.Sprintf("Nil timing on action plan: %+v, executing ASAP!", at)) + return true } return at.Timing.Timing.StartTime == utils.ASAP } diff --git a/scheduler/scheduler.go b/scheduler/scheduler.go index 27b804693..04bddd5c9 100644 --- a/scheduler/scheduler.go +++ b/scheduler/scheduler.go @@ -20,7 +20,6 @@ package scheduler import ( "fmt" - "log" "sort" "sync" "time" @@ -93,7 +92,6 @@ 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 { - log.Printf("AP %+v", ap) isAsap = ap.IsASAP() toBeSaved = toBeSaved || isAsap if isAsap { @@ -114,9 +112,6 @@ func (s *Scheduler) LoadActionPlans(storage engine.RatingStorage) { newApls = append(newApls, ap) } if toBeSaved { - for _, ap := range newApls { - log.Printf("NewAP: %+v", ap) - } engine.Guardian.Guard(func() (interface{}, error) { storage.SetActionPlans(key, newApls) return 0, nil