cron

package
v1.1.14 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrLockInstanceNotFound     utils.Error = "cron lock instance not found"
	ErrUnsupportedSchedulerType utils.Error = "unsupported cron scheduler type"
)

Variables

This section is empty.

Functions

func AppName

func AppName(name string) utils.OptionFunc[useOption]

func Construct

func Construct(ctx context.Context, confs map[string]*Conf, opts ...utils.OptionExtender) func()

Types

type Conf

type Conf struct {
	Type                 schedulerType        `yaml:"type" json:"type" toml:"type" default:"asynq"`
	Instance             string               `yaml:"instance" json:"instance" toml:"instance"`
	InstanceType         instanceType         `yaml:"instance_type" json:"instance_type" toml:"instance_type"`
	LockInstance         string               `yaml:"lock_instance" json:"lock_instance" toml:"lock_instance"`
	Queue                string               `yaml:"queue" json:"queue" toml:"queue"`
	Server               bool                 `yaml:"server" json:"server" toml:"server" default:"true"`
	Trigger              bool                 `yaml:"trigger" json:"trigger" toml:"trigger" default:"false"`
	ServerConcurrency    int                  `yaml:"server_concurrency" json:"server_concurrency" toml:"server_concurrency"`
	Timezone             string               `yaml:"timezone" json:"timezone" toml:"timezone" default:"Asia/Shanghai"`
	Tasks                map[string]*taskConf `yaml:"tasks" json:"tasks" toml:"tasks"`
	TaskLoader           string               `yaml:"task_loader" json:"task_loader" toml:"task_loader"`
	RefreshTasksInterval string               `yaml:"refresh_tasks_interval" json:"refresh_tasks_interval" toml:"refresh_tasks_interval" default:"3m"`

	EnableLogger bool   `yaml:"enable_logger" json:"enable_logger" toml:"enable_logger" default:"false"`
	LogLevel     string `yaml:"log_level" json:"log_level" toml:"log_level" default:"info"`
	Logger       string `yaml:"logger" json:"logger" toml:"logger" default:"github.com/wfusion/gofusion/log/customlogger.cronLogger"`
	LogInstance  string `yaml:"log_instance" json:"log_instance" toml:"log_instance" default:"default"`
}

Conf conf nolint: revive // struct tag too long issue

type IRouter

type IRouter interface {
	Use(mws ...routerMiddleware)
	Handle(pattern string, fn any, opts ...utils.OptionExtender)
	Serve() error
	Start() error
	// contains filtered or unexported methods
}

func Use

func Use(name string, opts ...utils.OptionExtender) IRouter

type Task

type Task interface {
	ID() string
	Name() string
	Payload() []byte
	RawMessage() any
}

Jump to

Keyboard shortcuts

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