asynq

package
v0.0.0-...-5ed4770 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package asynq provides an Asynq-backed implementation of the task.TaskQueue interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(redisURL string, concurrency int, logger *slog.Logger, opts ...Option) (task.TaskQueue, error)

New creates a new Asynq-backed TaskQueue. redisURL is the Redis connection URL (e.g., "redis://localhost:6379"). concurrency is the number of worker goroutines.

func NewInspectorManager

func NewInspectorManager(redisURL string, queueName string) (task.Manager, error)

NewInspectorManager creates a Manager backed by asynq.Inspector. redisURL is the Redis connection URL. queueName is the Asynq queue (default: "default").

Types

type Option

type Option func(*asynqQueue)

Option configures the Asynq queue.

func WithErrorHandler

func WithErrorHandler(h asynqlib.ErrorHandler) Option

WithErrorHandler sets the error handler for the Asynq server. Called on every non-nil error return from task handlers. Use asynq.GetRetryCount(ctx) and asynq.GetMaxRetry(ctx) inside the handler to detect final failure.

func WithRetryDelayFunc

func WithRetryDelayFunc(f asynqlib.RetryDelayFunc) Option

WithRetryDelayFunc sets a custom retry delay calculator. By default, Asynq uses exponential backoff. Useful for testing with fast retries.

Jump to

Keyboard shortcuts

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