MCPcopy Create free account
hub / github.com/codnect/chrono / CreateSchedulerTask

Function CreateSchedulerTask

task.go:20–40  ·  view source on GitHub ↗
(task Task, options ...Option)

Source from the content-addressed store, hash-verified

18}
19
20func CreateSchedulerTask(task Task, options ...Option) (*SchedulerTask, error) {
21 if task == nil {
22 return nil, errors.New("task cannot be nil")
23 }
24
25 runnableTask := &SchedulerTask{
26 task: task,
27 startTime: time.Time{},
28 location: time.Local,
29 }
30
31 for _, option := range options {
32 err := option(runnableTask)
33
34 if err != nil {
35 return nil, err
36 }
37 }
38
39 return runnableTask, nil
40}
41
42func (task *SchedulerTask) GetInitialDelay() time.Duration {
43 if task.startTime.IsZero() {

Callers 7

ScheduleMethod · 0.85
ScheduleWithCronMethod · 0.85
ScheduleAtFixedRateMethod · 0.85
TestNewSchedulerTaskFunction · 0.85

Calls

no outgoing calls