A distributed scheduled task tool written in Go. It was incubated and evolved from the go-sail framework.
go version >= 1.19
go get -u github.com/keepchen/schedule
- Interval task
- Once time task
- Linux Crontab Style task
- Cancelable
- Race detection
- Manual call
schedule.NewJob("say hello").EveryMinute()
schedule.NewJob("check in").RunOnceTimeAfter(time.Second)
schedule.NewJob("good morning").RunAt(schedule.EveryDayOfEightAMClock)
cancel := schedule.NewJob("say hello").EveryMinute()
time.AfterFunc(time.Minute*3, cancel)
Note: You must set redis provider before use.
// set redis provider
schedule.SetRedisProviderStandalone(...)
// or
schedule.SetRedisProviderClient(...)
schedule.NewJob("say hello").WithoutOverlapping().EveryMinute()
schedule.Call("say hello", false)
schedule.MustCall("task not exist will be panic", true)