cronTask: response to gc and health check TODO: Should move into runtime scheduler
(opt *options.ControllerOptions)
| 34 | // cronTask: response to gc and health check |
| 35 | // TODO: Should move into runtime scheduler |
| 36 | func (controller *Controller) cronTask(opt *options.ControllerOptions) { |
| 37 | taskID := id.GetTaskID() |
| 38 | logger := logs.NewLogger().WithField("task_id", taskID) |
| 39 | interval := time.Duration(opt.TaskInterval) * time.Second |
| 40 | ticker := time.NewTicker(interval) |
| 41 | for { |
| 42 | select { |
| 43 | case <-ticker.C: |
| 44 | logger.Debug("start cron task") |
| 45 | controller.resourceTask(logger) |
| 46 | controller.runtimeTask(logger) |
| 47 | logger.Debug("finish cron task") |
| 48 | } |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func (controller *Controller) metricTask(opt *options.ControllerOptions) { |
| 53 | taskID := id.GetTaskID() |
no test coverage detected