worker

package
v0.0.0-...-f838e45 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package worker performs heavy-lifting tasks in the background.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, name string, job Job, options ...Option) <-chan error

Add adds a job to the end of the queue (FIFO).

The returned channel can be queried to get the job result.

func AddAndWait

func AddAndWait(ctx context.Context, name string, job Job, options ...Option) error

AddAndWait adds the job to the queue and blocks until the job is finished.

It returns the error from the job or the context's error, whatever happens first.

Types

type Job

type Job func(ctx context.Context, progressChan chan<- float64) error

Job performs a task.

type Option

type Option func(o *options)

func WithMaxLogFrequency

func WithMaxLogFrequency(d time.Duration) Option

Jump to

Keyboard shortcuts

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