task

package
v0.0.1-beta Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(typename string, params any, priority ...Priority) *asynq.TaskInfo

func AddDelay

func AddDelay(typename string, params any, t time.Duration, priority ...Priority) *asynq.TaskInfo

func AddTask

func AddTask(typename string, params any, opts ...asynq.Option) *asynq.TaskInfo

func AddTime

func AddTime(typename string, params any, t time.Time, priority ...Priority) *asynq.TaskInfo

func DelTask

func DelTask(priority Priority, id string) error

func Init

func Init()

func ListenerScheduler

func ListenerScheduler(cron string, typename string, params any, priority ...Priority)

ListenerScheduler registers a task to be executed on a schedule cron: the schedule for the task typename: the name of the task type params: parameters for the task (can be of any type) priority: (optional) the priority group for the task

func ListenerTask

func ListenerTask(pattern string, handler func(context.Context, *asynq.Task) error)

ListenerTask registers a task to be executed on a queue

func Register

func Register()

func StartQueue

func StartQueue()

func StartScheduler

func StartScheduler()

Types

type Priority

type Priority string
const (
	PRIORITY_HIGH    Priority = "high"
	PRIORITY_DEFAULT Priority = "default"
	PRIORITY_LOW     Priority = "low"
)

type TaskLogger

type TaskLogger struct {
	Logger *slog.Logger
}

func (*TaskLogger) Debug

func (t *TaskLogger) Debug(args ...interface{})

func (*TaskLogger) Error

func (t *TaskLogger) Error(args ...interface{})

func (*TaskLogger) Fatal

func (t *TaskLogger) Fatal(args ...interface{})

func (*TaskLogger) Info

func (t *TaskLogger) Info(args ...interface{})

func (*TaskLogger) Warn

func (t *TaskLogger) Warn(args ...interface{})

type TaskService

type TaskService struct {
	Server    *asynq.Server
	ServeMux  *asynq.ServeMux
	Client    *asynq.Client
	Inspector *asynq.Inspector
	Scheduler *asynq.Scheduler
}

func NewTask

func NewTask(i do.Injector) (*TaskService, error)

func (*TaskService) Shutdown

func (s *TaskService) Shutdown() error

Jump to

Keyboard shortcuts

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