queue

package
v0.0.0-...-a4359f9 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Queue

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

Queue is a worker queue with a fixed amount of workers

func New

func New(ctx context.Context, workers int, handler func(context.Context, interface{}) (interface{}, error)) *Queue

New creates a new Queue with the specified amount of workers

func (*Queue) Process

func (q *Queue) Process(ctx context.Context, data interface{}) (interface{}, error)

Process adds a job to the queue, waits for it to process, and returns the result

func (*Queue) Run

func (q *Queue) Run()

Run starts the queue and blocks until it's shut down

Jump to

Keyboard shortcuts

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