scheduler

package
v0.0.0-...-270f78c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2023 License: Zlib Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Scheduler

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

func NewScheduler

func NewScheduler(ctx context.Context) *Scheduler

func (*Scheduler) Shutdown

func (s *Scheduler) Shutdown() error

Shutdown stops the scheduler and waits for it to stop if it is running; otherwise does nothing.

func (*Scheduler) StartJobEvery

func (s *Scheduler) StartJobEvery(duration time.Duration, job func() error) string

StartJobEvery schedules a new periodic job with a given duration. Returns job id that could be used to stop the given job. When job run returns an error, that job won't be run again.

func (*Scheduler) StopJob

func (s *Scheduler) StopJob(jobID string) error

StopJob stops the job from being run in the future

Jump to

Keyboard shortcuts

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