长表达式提取为变量,提升可读性

pull/21/merge
ouqiang 2017-04-03 18:04:49 +08:00
parent dc478dd1e6
commit c3f85f83cf
1 changed files with 2 additions and 1 deletions

View File

@ -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)
} }
} }