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: 0

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