We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WithLimitConcurrentJobs causes scheduled jobs not to run after StopJobs() then Start()
WithLimitConcurrentJobs
StopJobs()
Start()
func main() { s, err := gocron.NewScheduler( gocron.WithLimitConcurrentJobs(2, gocron.LimitModeReschedule), // this causes the bug ) if err != nil { panic(err) } // add a job to the scheduler _, err = s.NewJob( gocron.DurationJob( 10*time.Second, ), gocron.NewTask( func(a string, b int) { fmt.Println(time.Now().Format("2006-01-02 15:04:05"), a) }, "hello", 1, ), ) if err != nil { panic(err) } s.Start() // run schedule for 20 seconds select { case <-time.After(20 * time.Second): } // restart the scheduler s.StopJobs() s.Start() fmt.Println("Restarted Scheduler") // run schedule for another 30 seconds select { case <-time.After(30 * time.Second): } err = s.Shutdown() if err != nil { panic(err) } }
Output:
2024-04-29 09:08:59 hello Restarted Scheduler
Expected output:
2024-04-29 09:10:21 hello Restarted Scheduler 2024-04-29 09:10:31 hello 2024-04-29 09:10:41 hello 2024-04-29 09:10:51 hello
v2.5.0
Scheduled jobs should resume after Scheduler.Start()
Scheduler.Start()
The text was updated successfully, but these errors were encountered:
@jmutschler yes this is definitely a bug. Sorry, I haven't had a chance to dig into the code yet and see what's getting hung up.
Sorry, something went wrong.
No problem. I appreciate your time on this!
Found the issue, easy one to fix. Should be out here pretty soon
Thank you @JohnRoesler!
Successfully merging a pull request may close this issue.
Describe the bug
WithLimitConcurrentJobs
causes scheduled jobs not to run afterStopJobs()
thenStart()
To Reproduce
Output:
Expected output:
Version
v2.5.0
Expected behavior
Scheduled jobs should resume after
Scheduler.Start()
The text was updated successfully, but these errors were encountered: