tasker

package
v0.7.1-alpha Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueueName

type QueueName string
const (
	HighPriority    QueueName = "high_priority"
	DefaultPriority QueueName = "default_priority"
)

type Task

type Task struct {
	Id      string          `json:"id"`
	Payload json.RawMessage `json:"payload"`
}

type TaskName

type TaskName string
const (
	AccountRegisterTask  TaskName = "sys:register_account"
	AccountRefillGasTask TaskName = "sys:refill_gas"
	SignTransferTask     TaskName = "usr:sign_transfer"
	SignTransferTaskAuth TaskName = "usr:sign_transfer_auth"
	DispatchTxTask       TaskName = "rpc:dispatch"
)

type TaskerClient

type TaskerClient struct {
	Client *asynq.Client
}

func NewTaskerClient

func NewTaskerClient(o TaskerClientOpts) *TaskerClient

func (*TaskerClient) CreateTask

func (c *TaskerClient) CreateTask(ctx context.Context, taskName TaskName, queueName QueueName, task *Task, extraOpts ...asynq.Option) (*asynq.TaskInfo, error)

type TaskerClientOpts

type TaskerClientOpts struct {
	RedisPool *redis.RedisPool
}

type TaskerServer

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

func NewTaskerServer

func NewTaskerServer(o TaskerServerOpts) *TaskerServer

func (*TaskerServer) RegisterHandlers

func (ts *TaskerServer) RegisterHandlers(taskName TaskName, taskHandler func(context.Context, *asynq.Task) error)

func (*TaskerServer) RegisterMiddlewareStack

func (ts *TaskerServer) RegisterMiddlewareStack(middlewareStack []asynq.MiddlewareFunc)

func (*TaskerServer) Start

func (ts *TaskerServer) Start() error

func (*TaskerServer) Stop

func (ts *TaskerServer) Stop()

type TaskerServerOpts

type TaskerServerOpts struct {
	Concurrency      int
	ErrorHandler     asynq.ErrorHandler
	IsFailureHandler func(error) bool
	Logg             logf.Logger
	LogLevel         asynq.LogLevel
	RedisPool        *redis.RedisPool
	RetryHandler     asynq.RetryDelayFunc
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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