taskqueue

package
v3.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Notifier added in v3.3.1

type Notifier interface {
	SendEvent(event biz.NotifyEvent, subject, body string)
}

Notifier 事件通知,由 biz.NotifyUsecase 实现

type Runner

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

func NewRunner

func NewRunner(db *gorm.DB, log *slog.Logger, notifier Notifier, t *gotext.Locale) *Runner

NewRunner 创建任务运行器

func (*Runner) Cancel added in v3.3.0

func (r *Runner) Cancel(id uint) bool

Cancel 取消正在运行的任务,返回是否命中

func (*Runner) Notify

func (r *Runner) Notify()

Notify 非阻塞通知运行器有新任务,供 Push 调用

func (*Runner) Run

func (r *Runner) Run(ctx context.Context)

Run 启动运行器

func (*Runner) Wait added in v3.3.6

func (r *Runner) Wait(ctx context.Context)

Wait 等待运行协程收尾,ctx 到期则放弃等待 停机时正在跑的任务要写状态和跑清理命令,不等就会和进程退出赛跑

Jump to

Keyboard shortcuts

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