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