cronjobext

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	AsyncTaskConfig *config.Config `yaml:"-" ignored:"true"`
	BindTo          string         `yaml:"bind_to"`
	TimeZone        string         `yaml:"tz"`
	HealthCheckPort int            `yaml:"health_check_port"` // default is 5000
}

Config configuration of cronjobext

func (*Config) TZ

func (c *Config) TZ() (*time.Location, error)

TZ converts TimeZone to a pointer of time.Location

type CronJobExt

type CronJobExt struct {
	NS string
	// TimeZone scheduler's timezone
	TimeZone *time.Location
	// contains filtered or unexported fields
}

func (*CronJobExt) Application

func (t *CronJobExt) Application() *gobay.Application

func (*CronJobExt) Close

func (t *CronJobExt) Close() error

func (*CronJobExt) Init

func (t *CronJobExt) Init(app *gobay.Application) error

func (*CronJobExt) Object

func (t *CronJobExt) Object() interface{}

func (*CronJobExt) RegisterTasks

func (t *CronJobExt) RegisterTasks(ts map[string]*CronJobTask) error

RegisterTasks this function can only be used before the scheduler starting.

func (*CronJobExt) RemoveAllJobs

func (t *CronJobExt) RemoveAllJobs()

RemoveAllJobs stops and deletes all scheduled tasks, but the scheduler itself does not stop running

func (*CronJobExt) StartCronJob

func (t *CronJobExt) StartCronJob(enableHealthCheck bool)

StartCronJob this function will be blocked until the scheduler exits

type CronJobSchedulerType

type CronJobSchedulerType string
const (
	DurationScheduler CronJobSchedulerType = "duration" // time.ParseDuration style expressions
	CronScheduler     CronJobSchedulerType = "crontab"  // crontab style expressions
)

type CronJobTask

type CronJobTask struct {
	Type CronJobSchedulerType
	// Spec Scheduled interval or cron expression
	Spec string
	// TaskFunc the function be registered into AsyncTaskExt.
	// This function must also be registered on the async task worker side.
	TaskFunc interface{}
	// TaskSignature the args of the TaskFunc,
	// The value of tasks.Signature.Name must be the same as the Name with which the TaskFunc was registered.
	TaskSignature *tasks.Signature
}

Jump to

Keyboard shortcuts

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