cronext

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: MIT Imports: 6 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

CronExt

cron extend

Documentation

Index

Constants

View Source
const (
	// EventJobStarted  = "event.job.started"
	// EventJobDone     = "event.job.done"
	// EventJobFailed   = "event.job.failed"
	EventJobFinished = "event.job.finished"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	Job       string
	Scheduler string
	Logger    *zap.Logger
	Hs        JobHistoryService

	Bus EventBus.Bus
	// contains filtered or unexported fields
}

func (*Job) PrintNextRuntime

func (jb *Job) PrintNextRuntime(msg string)

func (*Job) Schedule

func (jb *Job) Schedule(cmd func()) error

func (*Job) SetTask added in v0.2.0

func (jb *Job) SetTask(task TaskWithHistory) error

func (*Job) WithHistory

func (jb *Job) WithHistory() cron.JobWrapper

type JobHistory

type JobHistory struct {
	Job      string
	Start    time.Time
	Finished time.Time
	Duration time.Duration
	Succeed  bool
	Message  string
}

type JobHistoryService

type JobHistoryService interface {
	ToHistory(job JobHistory) error
	GetLastRuntime(job string) (time.Time, error)
}

type RamHistoryService

type RamHistoryService struct {
	Logger *zap.Logger
	Inited time.Time
	// contains filtered or unexported fields
}

func (*RamHistoryService) GetLastRuntime

func (a *RamHistoryService) GetLastRuntime(job string) (time.Time, error)

func (*RamHistoryService) ToHistory

func (a *RamHistoryService) ToHistory(job JobHistory) error

type TaskWithHistory added in v0.2.0

type TaskWithHistory func(lastRuntime time.Time) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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