queue

package
v0.0.0-...-52e0d5c 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: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WaitForClose

func WaitForClose(q Instance, timeout time.Duration) error

WaitForClose blocks until the Instance has stopped processing tasks or the timeout expires. If the timeout is zero, it will wait until the queue is done processing. WaitForClose an error if the timeout expires.

Types

type DelayQueueOption

type DelayQueueOption func(*delayQueue)

DelayQueueOption configure the behavior of the queue. Must be applied before Run.

func DelayQueueBuffer

func DelayQueueBuffer(bufferSize int) DelayQueueOption

DelayQueueBuffer sets maximum number of tasks awaiting execution. If this limit is reached, Push and PushDelayed will block until there is room.

func DelayQueueWorkers

func DelayQueueWorkers(workers int) DelayQueueOption

DelayQueueWorkers sets the number of background worker goroutines await tasks to execute. Effectively the maximum number of concurrent tasks.

type Delayed

type Delayed interface {
	PushDelayed(t Task, delay time.Duration)
	// contains filtered or unexported methods
}

Delayed implements queue such that tasks are executed after a specified delay.

func NewDelayed

func NewDelayed(opts ...DelayQueueOption) Delayed

NewDelayed gives a Delayed queue with maximum concurrency specified by workers.

type Instance

type Instance interface {

	// HasSynced returns true once the queue has synced.
	// Syncing indicates that all items in the queue *before* Run was called have been processed.
	HasSynced() bool
	// contains filtered or unexported methods
}

func NewQueue

func NewQueue(errorDelay time.Duration) Instance

NewQueue instantiates a queue with a processing function

func NewQueueWithID

func NewQueueWithID(errorDelay time.Duration, name string) Instance

func NewWithSync

func NewWithSync(f func(), name string) Instance

NewQueue instantiates a queue with a processing function

type Task

type Task func() error

Task to be performed.

Jump to

Keyboard shortcuts

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