cron

package
v1.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager coordinates cron-based scheduling, allowing multiple schedule entries to share the same crontab expression while maintaining independent IDs.

func NewManager

func NewManager(logger *log.Logger) *Manager

NewManager creates a new cron Manager with the given context and logger.

func (*Manager) Add

func (m *Manager) Add(schedule shtypes.ScheduleEntry)

Add registers a schedule entry. If the crontab expression is already registered, the schedule ID is added to the existing entry. Otherwise, a new cron job is created. Invalid crontab expressions are logged and ignored.

func (*Manager) Ch

func (m *Manager) Ch() chan string

Ch returns the channel that receives crontab expressions when schedules fire.

func (*Manager) Remove

func (m *Manager) Remove(schedule shtypes.ScheduleEntry)

Remove unregisters a schedule entry. If this is the last schedule ID using the crontab expression, the underlying cron job is stopped and removed.

func (*Manager) Start

func (m *Manager) Start()

Start begins the cron scheduler. Can be called multiple times safely (only runs once).

func (*Manager) Stop

func (m *Manager) Stop()

Stop cancels the context and waits for the lifecycle goroutines to finish.

Jump to

Keyboard shortcuts

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