From c3f85f83cf311cc4b711b44284598294e27a074f Mon Sep 17 00:00:00 2001 From: ouqiang Date: Mon, 3 Apr 2017 18:04:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E8=A1=A8=E8=BE=BE=E5=BC=8F=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E4=B8=BA=E5=8F=98=E9=87=8F=EF=BC=8C=E6=8F=90=E5=8D=87?= =?UTF-8?q?=E5=8F=AF=E8=AF=BB=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- service/task.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/service/task.go b/service/task.go index 47c6e1c..56708ed 100644 --- a/service/task.go +++ b/service/task.go @@ -46,7 +46,8 @@ func (task *Task) Add(taskModel models.Task) { } } 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) } }