Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DistantFuture = time.Unix(4604952467, 0).UTC()
DistantFuture is Jan 2116. It is used to indicate that next tick should not happen.
Functions ¶
This section is empty.
Types ¶
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule knows when to run a periodic job (given current time and possibly a current state of the job).
See 'Parse' for a list of supported kinds of schedules.
func Parse ¶
Parse converts human readable definition of a schedule to *Schedule object.
Supported kinds of schedules (illustrated by examples):
- "* 0 * * * *": standard cron-like expression. Cron engine will attempt to start a job at specified moments in time (based on UTC clock). If when triggering a job, previous invocation is still running, an overrun will be recorded (and next attempt to start a job happens based on the schedule, not when the previous invocation finishes). This is absolute schedule (i.e. doesn't depend on job state).
- "with 10s interval": runs invocations in a loop, waiting 10s after finishing invocation before starting a new one. This is relative schedule. Overruns are not possible.
- "continuously" is alias for "with 0s interval", meaning the job will run in a loop without any pauses.
- "triggered" schedule indicates that job is always started via a trigger. 'Next' always returns DistantFuture constant.
func (*Schedule) IsAbsolute ¶
IsAbsolute is true for schedules that do not depend on a job state.
Absolute schedules are basically static time tables specifying when to attempt to run a job.
Non-absolute (aka relative) schedules may use job state transition times to make decisions.
See comment for 'Parse' for some examples.