task

package
v0.0.0-...-811544e Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultQueueName = "default"

Variables

This section is empty.

Functions

This section is empty.

Types

type AsynqTask

type AsynqTask struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(redis asynq.RedisClientOpt) *AsynqTask

func (*AsynqTask) Enqueue

func (u *AsynqTask) Enqueue(ctx context.Context, task *asynq.Task) (string, error)

func (*AsynqTask) GetTaskInfo

func (u *AsynqTask) GetTaskInfo(_ context.Context, queue, id string) (*Info, error)

func (*AsynqTask) GetTaskResponse

func (u *AsynqTask) GetTaskResponse(_ context.Context, queue, id string) (*Response, error)

type Error

type Error struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type Info

type Info struct {
	ID    string `json:"id"`
	State string `json:"status"`
	Error string `json:"error"`
}

type Response

type Response struct {
	ContentType string `json:"content_type"`
	Data        any    `json:"data"`
	Error       *Error `json:"error,omitempty"`
}

type Task

type Task interface {
	Enqueue(ctx context.Context, task *asynq.Task) (string, error)
	GetTaskInfo(ctx context.Context, queue, id string) (*Info, error)
	GetTaskResponse(ctx context.Context, queue, id string) (*Response, error)
}

Jump to

Keyboard shortcuts

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