Unverified Commit ed0f102c authored by KubeEdge Bot's avatar KubeEdge Bot Committed by GitHub
Browse files

Merge pull request #607 from rohitsardesai83/automated-cherry-pick-of-#563-upstream-release-0.3

Automated cherry pick of #563: Handled the case of invalid action in scheduler module
parents 8a2bff75 3ffab91d
Showing with 6 additions and 0 deletions
+6 -0
......@@ -78,9 +78,11 @@ func (schedule *Schedule) ExecuteSchedule(actionManager []actionmanager.Action,
// performScheduleOperation is responsible for performing the operations associated with the schedule
func (schedule *Schedule) performScheduleOperation(actionManager []actionmanager.Action, dataConverter dataconverter.DataRead, deviceID string) {
var scheduleResult ScheduleResult
actionExists := false
for _, actionName := range schedule.Actions {
for _, action := range actionManager {
if strings.ToUpper(action.Name) == strings.ToUpper(actionName) {
actionExists = true
glog.Infof("Performing scheduled operation: %s", action.Name)
action.PerformOperation(dataConverter)
scheduleResult.EventName = actionName
......@@ -92,6 +94,10 @@ func (schedule *Schedule) performScheduleOperation(actionManager []actionmanager
if schedule.Interval == 0 {
schedule.Interval = defaultEventFrequency
}
if !actionExists {
glog.Error("Action %s does not exist. Exiting from schedule !!!", actionName)
break
}
time.Sleep(time.Duration(time.Duration(schedule.Interval) * time.Millisecond))
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment