cron

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2026 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package cron provides a cron scheduling interface and its production implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronRunnable

type CronRunnable struct {
	// contains filtered or unexported fields
}

CronRunnable adapts a Scheduler to the manager.Runnable interface. It blocks until the context is cancelled, then stops the scheduler.

func NewCronRunnable

func NewCronRunnable(s Scheduler) *CronRunnable

NewCronRunnable creates a Runnable that stops the scheduler when the manager shuts down.

func (*CronRunnable) Start

func (r *CronRunnable) Start(ctx context.Context) error

Start blocks until ctx is done, then calls Stop on the scheduler.

type RealScheduler

type RealScheduler struct {
	*cron.Cron
}

RealScheduler wraps robfig/cron for production use.

func NewRealScheduler

func NewRealScheduler() *RealScheduler

NewRealScheduler creates a production cron scheduler.

func (*RealScheduler) Start

func (r *RealScheduler) Start()

Start starts the cron scheduler.

func (*RealScheduler) Stop

func (r *RealScheduler) Stop()

Stop stops the cron scheduler.

type Scheduler

type Scheduler interface {
	AddFunc(spec string, cmd func()) (cron.EntryID, error)
	Remove(id cron.EntryID)
	Start()
	Stop()
	Entries() []cron.Entry
}

Scheduler is an interface for cron scheduling operations.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL