crontab

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.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 Crontab

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

Crontab the warpper for cron.Cron, we can use it simply

TODO: if job doesn't complete timely, there will be a lot of go routines. We can do something for this.

func (*Crontab) AddFuncOneInstance

func (c *Crontab) AddFuncOneInstance(spec string, lockSec int, cmd func()) (cron.EntryID, error)

AddFuncOneInstance add function which only run in an (vm) environment when triggered

if lockSec <= 0, we will set lockSec to default value: 60

func (*Crontab) Cron

func (c *Crontab) Cron() *cron.Cron

Cron get the raw cron.Cron

func (*Crontab) Init

func (c *Crontab) Init(redisClient *redis.Client, opts ...cron.Option) error

Init init crontab

func (*Crontab) NewChain

func (c *Crontab) NewChain(w ...cron.JobWrapper) cron.Chain

NewChain warpper of cron.NewChain

func (*Crontab) OneInstanceCmd

func (c *Crontab) OneInstanceCmd(name string, lockSec int, cmd func()) (func(), error)

OneInstanceCmd construct a new cmd which only run in an (vm) environment when triggered

if lockSec <= 0, we will set lockSec to default value: 60
if some errors happened, it will return nil

func (*Crontab) Start

func (c *Crontab) Start()

Start start the cron

func (*Crontab) Stop

func (c *Crontab) Stop() context.Context

Stop stop the cron

Jump to

Keyboard shortcuts

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