asynq

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 7 Imported by: 2

Documentation

Overview

Package asynq provides various asynq utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger(ctx context.Context) *slog.Logger

GetLogger returns the slog.Logger instance from the provided context, if found, or slog.DefaultLogger otherwise.

func NewDefaultErrorHandler

func NewDefaultErrorHandler() asynq.ErrorHandlerFunc

NewDefaultErrorHandler returns an asynq.ErrorHandlerFunc, which logs the task and the reason why it has failed.

func NewLoggerMiddleware

func NewLoggerMiddleware(logger *slog.Logger) asynq.MiddlewareFunc

NewLoggerMiddleware returns a new asynq.MiddlewareFunc, which embeds a slog.Logger in the context provided to task handlers.

func NewMeasuringMiddleware

func NewMeasuringMiddleware() asynq.MiddlewareFunc

NewMeasuringMiddleware returns a new asynq.MiddlewareFunc which measures the execution of tasks.

func SkipRetry

func SkipRetry(err error) error

SkipRetry wraps the provided error with asynq.SkipRetry in order to signal asynq that the task should not retried.

func Unmarshal

func Unmarshal(data []byte, v any) error

Unmarshal unmarshals the given payload data by first attempting to unmarshal using json.Unmarshal, and if not successful then falls back to yaml.Unmarshal.

Types

This section is empty.

Jump to

Keyboard shortcuts

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