Skip to content

Commit 6f30f62

Browse files
committed
check if it is running when calling start(), avoid multiple run() goroutine
1 parent 32d9c27 commit 6f30f62

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cron.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ func (c *Cron) Entries() []*Entry {
123123

124124
// Start the cron scheduler in its own go-routine.
125125
func (c *Cron) Start() {
126+
if c.running {
127+
return
128+
}
126129
c.running = true
127130
go c.run()
128131
}

0 commit comments

Comments
 (0)