asynq

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

Functions

func PanicRecovery

func PanicRecovery() asynq.MiddlewareFunc

Types

type Client

type Client interface {
	Ping() error
	EnqueueContext(ctx context.Context, task *Task, opts ...Option) (*asynq.TaskInfo, error)
}

func NewClient

func NewClient(conf Config) Client

type Config

type Config struct {
	RedisURL     string
	Concurrency  int
	PoolSize     int
	TimeZone     string
	QueuesConfig map[string]int

	DisableCronJobEmitter bool

	Logger logger.Logger

	Middlewares []asynq.MiddlewareFunc
}

type HandleFunc

type HandleFunc func(context.Context, *Task) error

type Manager

type Manager interface {
	// will launch goroutine, blocks until some specified `os.Signal`s received
	Run()

	RegisterHandler(name string, fn HandleFunc)

	// will set a job id which ensure cron triggers the job only once when time is up.
	// be careful when set a retention which should be end before the next turn,
	// otherwise the job will not be triggered in the next turn due to the conflict job id.
	RegisterCron(cronspec string, task *Task, opts ...Option) (entryID string, err error)
}

func NewManager

func NewManager(conf Config) Manager

type Option

type Option = asynq.Option

type Task

type Task struct {
	*asynq.Task
	// contains filtered or unexported fields
}

func NewTask

func NewTask(typename string, payload []byte, headers map[string]string, opts ...Option) *Task

func (*Task) Opts

func (t *Task) Opts() []Option

Jump to

Keyboard shortcuts

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