scheduler

package
v0.2.29 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2025 License: Apache-2.0 Imports: 13 Imported by: ? 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

View Source
const Name = "scheduler"

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.2.11

type Config struct {
	Timeout     string       `yaml:"timeout"`
	JobSettings []JobSetting `yaml:"jobs"`
}

type CronRouter added in v0.2.11

type CronRouter interface {
	Crontab(s *Scheduler)
}

type JobFunc added in v0.2.11

type JobFunc func(ctx context.Context, name string) error

type JobSetting added in v0.2.11

type JobSetting struct {
	Disabled bool   `yaml:"disabled"`
	Schedule string `yaml:"schedule"`
	Name     string `yaml:"name"`
	Timeout  string `yaml:"timeout"`
}

type Scheduler

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

func New added in v0.2.11

func New(m lifecycle.Lifecycle, log log.Logger, opts []*Config, routers []CronRouter, metric metrics.Metric) *Scheduler

func (*Scheduler) Cron

func (s *Scheduler) Cron(name, expr string, fn JobFunc)

func (*Scheduler) Every

func (s *Scheduler) Every(name string, dur time.Duration, fn JobFunc)

func (*Scheduler) Once

func (s *Scheduler) Once(name string, delay time.Duration, fn JobFunc)

Jump to

Keyboard shortcuts

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