cron

package
v1.74.2 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

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