Skip to content

A distributed scheduled task tool written in Go.

License

Notifications You must be signed in to change notification settings

keepchen/schedule

Repository files navigation

Schedule

Go CodeQL Go Report Card
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").RunOnceTimeAfter(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(...)
// or
schedule.SetRedisProviderClient(...)

schedule.NewJob("say hello").WithoutOverlapping().EveryMinute()

Manual call

schedule.Call("say hello", false)

schedule.MustCall("task not exist will be panic", true)

About

A distributed scheduled task tool written in Go.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages