Documentation
¶
Overview ¶
Package cron runs named jobs once their interval has passed, each under a lease in a store.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrLeaseLost = errors.New("cron: lease lost")
ErrLeaseLost marks a settle whose lease another run has taken over.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Jobs []Job
Store Store
Clock func() time.Time
TimeLimit time.Duration
Lease time.Duration
Logger *slog.Logger
}
Config is what a runner is built from: the jobs, their store, the clock and the limits.
type Job ¶
type Job struct {
Name string
Every time.Duration
Run func(ctx context.Context, now time.Time) error
}
Job is one named piece of work that falls due again each time its interval passes.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner runs a list of cron jobs, one at a time.
Click to show internal directories.
Click to hide internal directories.