work

package
v0.0.0-...-3f5ce87 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MeterName = "github.com/ianunruh/go-backend-app/internal/work"
View Source
const TracerName = "github.com/ianunruh/go-backend-app/internal/work"

Variables

View Source
var (
	CriticalQueue = asynq.Queue("critical")
	HighQueue     = asynq.Queue("high")
	LowQueue      = asynq.Queue("low")
)

Functions

func AsynqConfig

func AsynqConfig(cfg Config, log *zap.Logger) asynq.Config

func DecodeTask

func DecodeTask(task *asynq.Task, out any) error

func IsDuplicateTaskErr

func IsDuplicateTaskErr(err error) bool

func NewAsynqScheduler

func NewAsynqScheduler(redisOpt asynq.RedisClientOpt, log *zap.Logger) *asynq.Scheduler

func NewServeMux

func NewServeMux(
	meterProvider *sdkmetric.MeterProvider,
	tracerProvider *sdktrace.TracerProvider,
	log *zap.Logger,
) *asynq.ServeMux

func NewTask

func NewTask(typename string, payload any, opts ...asynq.Option) (*asynq.Task, error)

func RegisterScheduledTasks

func RegisterScheduledTasks(sch *asynq.Scheduler, tasks ...SchedulerFunc) error

Types

type Config

type Config struct {
	Concurrency int `env:"CONCURRENCY" envDefault:"10"`
}

type Queue

type Queue interface {
	Enqueue(ctx context.Context, task *asynq.Task, opts ...asynq.Option) (*asynq.TaskInfo, error)
	Close() error
}

func NewQueue

func NewQueue(r asynq.RedisConnOpt, meterProvider *sdkmetric.MeterProvider, tracerProvider *sdktrace.TracerProvider, log *zap.Logger) Queue

type SchedulerFunc

type SchedulerFunc func(sch *asynq.Scheduler) error

Jump to

Keyboard shortcuts

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