CreateTask create new task with TaskConfig and register to task service
(config TaskConfig)
| 207 | |
| 208 | // CreateTask create new task with TaskConfig and register to task service |
| 209 | func (service *TaskService) CreateTask(config TaskConfig) (Task, error) { |
| 210 | if config.TaskType == TaskType_Cron { |
| 211 | return service.CreateCronTask(config.TaskID, config.IsRun, config.Express, config.Handler, config.TaskData) |
| 212 | } else if config.TaskType == TaskType_Loop { |
| 213 | return service.CreateLoopTask(config.TaskID, config.IsRun, config.DueTime, config.Interval, config.Handler, config.TaskData) |
| 214 | } else if config.TaskType == TaskType_Loop { |
| 215 | return service.CreateLoopTask(config.TaskID, config.IsRun, config.DueTime, config.Interval, config.Handler, config.TaskData) |
| 216 | } |
| 217 | return nil, ErrNotSupportTaskType |
| 218 | } |
| 219 | |
| 220 | // CreateCronTask create new cron task and register to task service |
| 221 | func (service *TaskService) CreateCronTask(taskID string, isRun bool, express string, handler TaskHandle, taskData interface{}) (Task, error) { |
nothing calls this directly
no test coverage detected