mirror of https://github.com/ouqiang/gocron
长表达式提取为变量,提升可读性
parent
dc478dd1e6
commit
c3f85f83cf
|
@ -46,7 +46,8 @@ func (task *Task) Add(taskModel models.Task) {
|
||||||
}
|
}
|
||||||
} else if taskModel.Type == models.Delay {
|
} else if taskModel.Type == models.Delay {
|
||||||
// 延时任务
|
// 延时任务
|
||||||
time.AfterFunc(time.Duration(taskModel.Delay)*time.Second, taskFunc)
|
delay := time.Duration(taskModel.Delay) * time.Second
|
||||||
|
time.AfterFunc(delay, taskFunc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue