scheduler

package
v0.170.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseCron

func ParseCron(expr string) error

ParseCron is a package-level helper for callers that don't have a Service instance yet (e.g. validation in the Schedule tool's Validate method).

Types

type Options

type Options struct {
	Store       storage.ScheduledJobStorage
	Runs        storage.ScheduledRunStorage
	OnRunEvent  func(domain.ScheduledJob, domain.RunEvent)
	ExecCommand agentrunner.ExecFunc
	BinaryPath  string
}

Options bundles dependencies and configuration for NewService.

type Service

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

Service runs scheduled jobs inside the `infer daemon` process. Jobs are loaded from the configured ScheduledJobStorage, registered with a robfig/cron scheduler, and hot-reloaded by polling the storage and diffing (reconcile).

On fire, a fresh `infer headless --session-id <uuid>` subprocess is spawned - every fire gets a brand-new session, so no context carries between runs. A RunRecord is persisted per fire (keyed by that session ID, so the run's conversation is discoverable from storage), and progress is emitted through the optional OnRunEvent hook. The scheduler knows nothing about channels - delivery is a subscriber concern (see services.ScheduleNotifier).

func NewService

func NewService(opts Options) (*Service, error)

NewService constructs a Service. Returns an error if required deps are missing.

func (*Service) JobIDs

func (s *Service) JobIDs() []string

JobIDs returns the set of currently-registered job IDs (test helper).

func (*Service) ParseCron

func (s *Service) ParseCron(expr string) error

ParseCron exposes the same parser the service uses, so the Schedule tool can validate cron expressions identically before persisting them.

func (*Service) Start

func (s *Service) Start(ctx context.Context) error

Start initialises the cron scheduler, loads all jobs from storage, and begins polling storage for changes.

func (*Service) Stop

func (s *Service) Stop(ctx context.Context) error

Stop halts the watcher and waits for in-flight cron entries to finish (up to the deadline embedded in ctx, if any).

Jump to

Keyboard shortcuts

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