As we all know HR can manage jobs.
- run cron jobs that registered with cron express syntax.
- when stops, will wait for running jobs to finish
- customizable
onStart
andonEnd
- will not propagate panic which can be captured in
onEnd
as an error
hr := JobManager{}
hr.Register("hello job", "* * * * * *", func() {
// job logic goes here
log.Println("say hello once.")
})
hr.Start()
defer hr.Quit()
#dependency
- cronexpr for parsing cron expression.