Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnqueueWaiting ¶
EnqueueWaiting passes a task to a worker and waits until it has been processed.
Types ¶
type Awaiter ¶
type Awaiter func() error
Awaiter is returned by AsyncAwait to wait for the worker to finish a task.
func AsyncAwait ¶
AsyncAwait passes a task to a worker and returns an Awaiter to wait for the worker to finish the task. The timeout is the maximum time to wait for the worker to finish the task. After enqueuing the task different work can be done before waiting for the worker to finish the task.
type NotStartedError ¶
type NotStartedError struct{}
NotStartedError signals that the worker processor did not start.
func (NotStartedError) Error ¶
func (NotStartedError) Error() string
type Option ¶
Option defines the signature of an option setting function.
func WithRateBurst ¶
WithRateBurst sets the rate and the burst values of a worker. Rate is the number of tasks processed per second, burst the number of tasks processed at once (means enqueued to the worker at ounce). If burst is 0 the rate is used as burst.
Be aware that a high rate and burst can lead to a high CPU load.
func WithTimeout ¶
type ShuttingDownError ¶
type ShuttingDownError struct{}
ShuttingDownError signals that the worker processor is shutting down.
func (ShuttingDownError) Error ¶
func (ShuttingDownError) Error() string
type Task ¶
type Task func() error
Task defines the signature of a task functionto be processed by a worker.
type TimeoutError ¶
type TimeoutError struct{}
TimeoutError signals that the worker processor did not start in time.
func (TimeoutError) Error ¶
func (TimeoutError) Error() string