scheduler

package
v0.158.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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