diff options
| author | KubeEdge Bot <48982446+kubeedge-bot@users.noreply.github.com> | 2019-05-29 19:56:57 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-05-29 19:56:57 +0530 |
| commit | ed0f102c9d916010c81cd1859d32c4c01e27e92b (patch) | |
| tree | f8d960e0ff6b7b347f2def594720c33018918c49 | |
| parent | Merge pull request #606 from rohitsardesai83/automated-cherry-pick-of-#561-up... (diff) | |
| parent | Handled the case of invalid action in scheduler module (diff) | |
| download | kubeedge-origin/release-0.3.tar.gz | |
Merge pull request #607 from rohitsardesai83/automated-cherry-pick-of-#563-upstream-release-0.3v0.3.0origin/release-0.3
Automated cherry pick of #563: Handled the case of invalid action in scheduler module
| -rw-r--r-- | device/bluetooth_mapper/scheduler/scheduler.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/device/bluetooth_mapper/scheduler/scheduler.go b/device/bluetooth_mapper/scheduler/scheduler.go index cf758d252..3f0695941 100644 --- a/device/bluetooth_mapper/scheduler/scheduler.go +++ b/device/bluetooth_mapper/scheduler/scheduler.go @@ -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)) } } |
