background

package
v0.0.0-...-53bd342 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Background

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

Background is a container of concurrently executed tasks. It handles tasks's errors by logging them. It also recovers in case of panics.

func New

func New(log logrus.FieldLogger) *Background

New constructs and returns a new Background.

func (*Background) Add

func (bg *Background) Add(f func() error)

Add inserts a new task, which will be executed in background.

func (*Background) Shutdown

func (bg *Background) Shutdown(ctx context.Context) error

Shutdown waits for tasks to complete. If the passed context expires then it returns an error indicating that some task didn't terminate in time.

Jump to

Keyboard shortcuts

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