Skip to content

Commit 3625689

Browse files
authored
Merge pull request robfig#54 from cloudfly/fixbug-multiple-run-goroutine
check if it is running when calling start()
2 parents 339702a + 65b40be commit 3625689

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cron.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,11 @@ func (c *Cron) Entries() []*Entry {
125125
return c.entrySnapshot()
126126
}
127127

128-
// Start the cron scheduler in its own go-routine.
128+
// Start the cron scheduler in its own go-routine, or no-op if already started.
129129
func (c *Cron) Start() {
130+
if c.running {
131+
return
132+
}
130133
c.running = true
131134
go c.run()
132135
}

0 commit comments

Comments
 (0)