This commit is contained in:
2023-08-11 16:47:21 +08:00
parent 5bd0e4335f
commit 18cd67a9ad
+16 -2
View File
@@ -92,9 +92,23 @@ func (tw *TimeWheel) checkAndRunTask() {
// 执行任务时,Task.job是第一优先级,然后是TimeWheel.job
if task.Job != nil {
go task.Job.Execute(nil, nil)
go func() {
defer func() {
if r := recover(); nil != r {
}
}()
_, _ = task.Job.Execute(nil, nil)
}()
} else if tw.Job != nil {
go tw.Job.Execute(nil, nil)
go func() {
defer func() {
if r := recover(); nil != r {
}
}()
_, _ = tw.Job.Execute(nil, nil)
}()
} else {
fmt.Println(fmt.Sprintf("The task %v don't have job to run", task.Key))
}