Commit 4d8e1f93 authored by astaxie's avatar astaxie

Merge pull request #1909 from albertma/master

Start timer task Multiple times
parents 73f49994 e607be6f
...@@ -389,6 +389,10 @@ func dayMatches(s *Schedule, t time.Time) bool { ...@@ -389,6 +389,10 @@ func dayMatches(s *Schedule, t time.Time) bool {
// StartTask start all tasks // StartTask start all tasks
func StartTask() { func StartTask() {
if isstart {
//If already started, no need to start another goroutine.
return
}
isstart = true isstart = true
go run() go run()
} }
...@@ -432,8 +436,11 @@ func run() { ...@@ -432,8 +436,11 @@ func run() {
// StopTask stop all tasks // StopTask stop all tasks
func StopTask() { func StopTask() {
isstart = false if isstart {
stop <- true isstart = false
stop <- true
}
} }
// AddTask add task with name // AddTask add task with name
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment