cron

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package cron provides support for Zero cron jobs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job func(ctx context.Context) error

Job represents a cron job.

type Schedule

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

func (*Schedule) NextRun

func (s *Schedule) NextRun() time.Time

NextRun returns the next time the job should run.

func (*Schedule) String

func (s *Schedule) String() string

type Scheduler

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

func NewScheduler

func NewScheduler(ctx context.Context, logger *slog.Logger, leaser leases.Leaser) *Scheduler

NewScheduler creates a new cron scheduler.

The Scheduler uses leases.Leaser to prevent cron jobs from running concurrently.

func (*Scheduler) Register

func (s *Scheduler) Register(name string, schedule time.Duration, job Job) error

Register a new cron job.

Jump to

Keyboard shortcuts

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