backgroundjob

package
v0.0.0-...-2bc625b Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAfterDuration = 5 * time.Minute

Variables

This section is empty.

Functions

func Main

func Main(ctx context.Context, logger *log.Logger, runners []*Runner)

Main takes a list of runners and start them. Upon receiving SIGINT or SIGTERM, stop them gracefully.

Types

type Runnable

type Runnable interface {
	Run(ctx context.Context) error
}

type RunnableFactory

type RunnableFactory func() Runnable

type Runner

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

func NewRunner

func NewRunner(ctx context.Context, logger *log.Logger, runnableFactory RunnableFactory, opts ...RunnerOption) *Runner

func (*Runner) Start

func (r *Runner) Start()

func (*Runner) Stop

func (r *Runner) Stop(ctx context.Context)

type RunnerOption

type RunnerOption interface {
	// contains filtered or unexported methods
}

func WithAfterDuration

func WithAfterDuration(d time.Duration) RunnerOption

Jump to

Keyboard shortcuts

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