scheduler

package
v0.156.2 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: Apache-2.0 Imports: 14 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 ChannelLookupFn

type ChannelLookupFn func(name string) domain.Channel

ChannelLookupFn returns the registered Channel for a name, or nil if unknown.

type Options

type Options struct {
	Store         storage.ScheduledJobStorage
	ChannelLookup ChannelLookupFn
	// ExecCommand defaults to exec.CommandContext when nil.
	ExecCommand agentrunner.ExecFunc
	// BinaryPath defaults to os.Args[0] (current binary) when empty.
	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 channels-manager daemon. 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 agent --session-id <uuid>` subprocess is spawned - every fire gets a brand-new session, so no context carries between runs. Each assistant line emitted by the agent is forwarded to the configured channel/recipient via the in-process channel lookup.

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