Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WrapTimeout ¶
WrapTimeout wraps the `Run` interface method with a timeout-dependent context.
Types ¶
type DailyTask ¶
type DailyTask struct { TimeOfDay string Priority uint TTL time.Duration SkipStart bool RunFunc func(context.Context) error }
DailyTask is a Task that is run every day.
func (DailyTask) GetPriority ¶
GetPriority returns the task priority.
func (DailyTask) GetRate ¶
func (d DailyTask) GetRate() interface{}
GetRate returns the repeat frequency for the task.
func (DailyTask) GetTTL ¶
GetTTL returns the maximum duration of the task. This parameter is to prevent the task from running too long if it hangs.
func (DailyTask) Run ¶
Run wraps the internal RunFunc field. This method runs it and returns the result.
func (DailyTask) SkipStartup ¶
SkipStartup returns whether or not the task should be skipped during the initial startup phase.
type MinuteTask ¶
type MinuteTask struct { Rate uint64 Priority uint TTL time.Duration SkipStart bool RunFunc func(context.Context) error }
MinuteTask is a Task that is run every n minutes where Rate defines how often the task is run.
func (MinuteTask) GetPriority ¶
func (m MinuteTask) GetPriority() uint
GetPriority returns the task priority.
func (MinuteTask) GetRate ¶
func (m MinuteTask) GetRate() interface{}
GetRate returns the repeat frequency for the task.
func (MinuteTask) GetTTL ¶
func (m MinuteTask) GetTTL() time.Duration
GetTTL returns the maximum duration of the task. This parameter is to prevent the task from running too long if it hangs.
func (MinuteTask) Run ¶
func (m MinuteTask) Run(ctx context.Context) error
Run wraps the internal RunFunc field. This method runs it and returns the result.
func (MinuteTask) SkipStartup ¶
func (m MinuteTask) SkipStartup() bool
SkipStartup returns whether or not the task should be skipped during the initial startup phase.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is the main background task runner in this package.