1
0
镜像自地址 https://github.com/astaxie/beego.git 已同步 2025-07-05 22:30:17 +00:00

1.fix start task twice issue

这个提交包含在:
albertma
2016-04-26 18:11:49 +08:00
父节点 88c5dfa6ea
当前提交 710c7c79d4

查看文件

@ -389,11 +389,16 @@ func dayMatches(s *Schedule, t time.Time) bool {
// StartTask start all tasks
func StartTask() {
if isstart {
//If already started, no need to start another goroutine.
return
}
isstart = true
go run()
}
func run() {
now := time.Now().Local()
for _, t := range AdminTaskList {
t.SetNext(now)
@ -417,7 +422,7 @@ func run() {
if e.GetNext() != effective {
break
}
go e.Run()
go e.Run()
e.SetPrev(e.GetNext())
e.SetNext(effective)
}
@ -432,8 +437,11 @@ func run() {
// StopTask stop all tasks
func StopTask() {
isstart = false
stop <- true
if(isstart){
isstart = false
stop <- true
}
}
// AddTask add task with name