delayed

package
v1.2.12 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadDelayed = &badDelayed{}
View Source
var ErrorRepeatShutdown = errors.New("重复关闭")

Functions

func SetCheckTime

func SetCheckTime(checkTime time.Duration) options.Option

SetCheckTime 设置检查时间

func SetSingle

func SetSingle(signal ...os.Signal) options.Option

SetSingle 设置监控信号

func SetSingleCallback

func SetSingleCallback(callback func(signal os.Signal, d *DispatchingDelayed)) options.Option

SetSingleCallback 设置监控信号回调

func SetWorkerNumber

func SetWorkerNumber(w int64) options.Option

SetWorkerNumber 设置并发数

Types

type Delayed

type Delayed interface {
	Do()              // 执行任务
	ExecTime() int64  // 执行时间 time.Unix()
	Identify() string // 任务唯一标识
}

type DispatchingDelayed

type DispatchingDelayed struct {
	sync.RWMutex

	Worker int64 // 并发数(实际执行任务)
	// contains filtered or unexported fields
}

DispatchingDelayed 调度延时任务. Concurrency safety

func NewDispatchingDelayed

func NewDispatchingDelayed(o ...options.Option) *DispatchingDelayed

NewDispatchingDelayed 初始化调度实例

func (*DispatchingDelayed) AddDelayed

func (d *DispatchingDelayed) AddDelayed(delayed Delayed)

AddDelayed 添加延时任务

func (*DispatchingDelayed) Close

func (d *DispatchingDelayed) Close() error

Close 关闭

func (*DispatchingDelayed) IsInvalid

func (d *DispatchingDelayed) IsInvalid(delayed Delayed) bool

IsInvalid 判断任务是否有效

func (*DispatchingDelayed) Refresh

func (d *DispatchingDelayed) Refresh()

Refresh 刷新

Jump to

Keyboard shortcuts

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