worker

package
v0.0.0-...-22b259a Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartScheduled

func StartScheduled(cfg Config) error

Types

type Config

type Config struct {
	Logger  zerolog.Logger
	Crontab []CronJob
}

type CronJob

type CronJob struct {
	Cron string
	Job  Job
}

type Job

type Job interface {
	Name() string
	Run(context.Context) error
}

type JobHandle

type JobHandle interface {
	Wait() <-chan error
}

type Pool

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

func NewPool

func NewPool(logger zerolog.Logger, options ...PoolOption) *Pool

func (*Pool) Shutdown

func (p *Pool) Shutdown()

func (*Pool) Submit

func (p *Pool) Submit(ctx context.Context, j Job) JobHandle

type PoolOption

type PoolOption func(*Pool)

func PoolStopTimeout

func PoolStopTimeout(t time.Duration) PoolOption

type Scheduler

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

func NewScheduler

func NewScheduler(logger zerolog.Logger) (*Scheduler, error)

func (*Scheduler) Schedule

func (s *Scheduler) Schedule(ctx context.Context, cronexpr string, j Job) (JobHandle, error)

func (*Scheduler) ScheduleEvery

func (s *Scheduler) ScheduleEvery(ctx context.Context, t time.Duration, j Job) (JobHandle, error)

func (*Scheduler) Shutdown

func (s *Scheduler) Shutdown()

func (*Scheduler) Start

func (s *Scheduler) Start()

Jump to

Keyboard shortcuts

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