MCPcopy Create free account
hub / github.com/baidu/EasyFaaS / cronTask

Method cronTask

pkg/controller/task.go:36–50  ·  view source on GitHub ↗

cronTask: response to gc and health check TODO: Should move into runtime scheduler

(opt *options.ControllerOptions)

Source from the content-addressed store, hash-verified

34// cronTask: response to gc and health check
35// TODO: Should move into runtime scheduler
36func (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
52func (controller *Controller) metricTask(opt *options.ControllerOptions) {
53 taskID := id.GetTaskID()

Callers 1

InitFunction · 0.80

Calls 6

resourceTaskMethod · 0.95
runtimeTaskMethod · 0.95
GetTaskIDFunction · 0.92
NewLoggerFunction · 0.92
WithFieldMethod · 0.80
DebugMethod · 0.80

Tested by

no test coverage detected