소스 검색

Merge pull request #54 from cloudfly/fixbug-multiple-run-goroutine

check if it is running when calling start()
Rob Figueiredo 9 년 전
부모
커밋
362568997a
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      cron.go

+ 4 - 1
cron.go

@@ -125,8 +125,11 @@ func (c *Cron) Entries() []*Entry {
 	return c.entrySnapshot()
 }
 
-// Start the cron scheduler in its own go-routine.
+// Start the cron scheduler in its own go-routine, or no-op if already started.
 func (c *Cron) Start() {
+	if c.running {
+		return
+	}
 	c.running = true
 	go c.run()
 }