schedule

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package schedule provides cron-based scheduling for sync operations

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateSpec

func ValidateSpec(spec string) error

ValidateSpec validates a cron expression

Types

type Scheduler

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

Scheduler manages cron-based sync execution

func New

func New(spec string, syncFn SyncFunc) (*Scheduler, error)

New creates a new Scheduler. Returns an error if the cron spec is invalid.

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context) error

Run executes an immediate sync, then starts the cron loop. It blocks until the context is cancelled. Sync errors are logged but do not stop the scheduler. Overlapping runs are skipped via cron.SkipIfStillRunning.

type SyncFunc

type SyncFunc func(ctx context.Context) error

SyncFunc is the function signature for sync callbacks

Jump to

Keyboard shortcuts

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