cronstrater

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSimpleJob

func AddSimpleJob(spec string, cmd func()) (cron.EntryID, error)

AddSimpleJob 添加简单任务

func AddSimpleSingletonJob

func AddSimpleSingletonJob(spec string, cmd func()) (cron.EntryID, error)

AddSimpleSingletonJob 添加简单单例任务 该任务将忽略正在运行的任务的调度

func NewJob

func NewJob(jobName string, spec *string, autoReloadSpec bool, cmd func(), multiRun ...bool) *jobFunc

NewJob 初始化一个Job配置

func NewJobAndRegister

func NewJobAndRegister(jobName string, spec *string, autoReloadSpec bool, cmd func(), multiRun ...bool) error

NewJobAndRegister 初始化一个Job配置 并注册

func RawCron

func RawCron() *cron.Cron

RawCron 获取原始的cron实例

func Start

func Start()

Start 启动已注册任务 如果CronModule.ManualStart = true 时一定需要手动开启

Types

type CronConfig added in v0.1.8

type CronConfig struct {
	// 启动详细日志
	EnableLogger bool

	// 手动启动定时任务
	// 如果手动启动需要手动调用cronstrater.Start()方法启动整个任务执行器
	ManualStart bool
}

type CronStarter

type CronStarter struct {
	Config     CronConfig
	LazyConfig func() CronConfig

	CornSetting *parent.Setting
	// contains filtered or unexported fields
}

func (*CronStarter) Setting

func (c *CronStarter) Setting() *parent.Setting

func (*CronStarter) Start

func (c *CronStarter) Start() (interface{}, error)

func (*CronStarter) Stop

func (c *CronStarter) Stop(maxWaitTime time.Duration) (gracefully, stopped bool, err error)

Jump to

Keyboard shortcuts

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