cron

package
v0.0.0-...-25d1615 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetManagerResource

func GetManagerResource(ctx context.Context) *rest_client.Resource

func StartCronTasks

func StartCronTasks()

func StartRetryTask

func StartRetryTask(maxMinutes int, taskParam *RetryTaskParam)

func StopCronTasks

func StopCronTasks()

Types

type CronTask

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

func RegisterCronTask

func RegisterCronTask(tname string, spec string, f toolbox.TaskFunc) *CronTask

func RegisterPipeTask

func RegisterPipeTask(pi pipeInterface, spec string) *CronTask

func RegisterTask

func RegisterTask(task taskInterface, spec string) *CronTask

func RegisterTaskInRestMode

func RegisterTaskInRestMode(task taskInterface, spec string) *CronTask

func (*CronTask) OnlyRun

func (this *CronTask) OnlyRun()

type Pipe

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

func NewPipe

func NewPipe(chCap int) Pipe

func (Pipe) AddData

func (p Pipe) AddData(data interface{}) error

func (Pipe) EnableParallel

func (p Pipe) EnableParallel() bool

EnableParallel 启用并行,默认启用

func (Pipe) GetCap

func (p Pipe) GetCap() int

func (Pipe) GetConsumerCount

func (p Pipe) GetConsumerCount() int

GetConsumerCount 消费者数量 默认为通道容量十分之一

func (Pipe) GetData

func (p Pipe) GetData() interface{}

func (Pipe) RunConsumer

func (p Pipe) RunConsumer() error

type RetryTaskParam

type RetryTaskParam struct {
	NewContext         func() context.Context
	GetDatas           func() []interface{}
	BeforeAction       func(data interface{}) error
	DoAction           func(ctx context.Context, times int, data interface{}) error
	AfterActionSuccess func(data interface{}) error
	AfterActionFail    func(data interface{}) error
	GetTaskDataId      func(data interface{}) string
	RecordFailByPanic  func(data interface{}, error string)
}

type Task

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

func NewTask

func NewTask(name string) Task

func (*Task) GetName

func (t *Task) GetName() string

func (*Task) IsEnableTx

func (t *Task) IsEnableTx() bool

func (*Task) Run

func (t *Task) Run(taskContext *TaskContext) error

func (*Task) SetName

func (t *Task) SetName(name string)

type TaskContext

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

func (*TaskContext) GetCtx

func (this *TaskContext) GetCtx() context.Context

func (*TaskContext) GetOrm

func (this *TaskContext) GetOrm() *gorm.DB

func (*TaskContext) GetResource

func (this *TaskContext) GetResource() *rest_client.Resource

func (*TaskContext) Init

func (this *TaskContext) Init(ctx context.Context, o *gorm.DB, resource *rest_client.Resource)

func (*TaskContext) SetCtx

func (this *TaskContext) SetCtx(ctx context.Context)

Directories

Path Synopsis
Package toolbox healthcheck
Package toolbox healthcheck

Jump to

Keyboard shortcuts

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