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: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 added in v1.0.1

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 added in v1.0.1

func NewCronRunnable(s Scheduler) *CronRunnable

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

func (*CronRunnable) Start added in v1.0.1

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