You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gojobs/jobs.go

31 lines
1.1 KiB

2 years ago
package gojobs
2 years ago
import (
"context"
"go.dtapp.net/gojobs/jobs_gorm_model"
)
2 years ago
const (
2 years ago
TASK_IN = "IN" // 任务运行
TASK_SUCCESS = "SUCCESS" // 任务完成
TASK_ERROR = "ERROR" // 任务异常
TASK_TIMEOUT = "TIMEOUT" // 任务超时
TASK_WAIT = "WAIT" // 任务等待
2 years ago
)
2 years ago
// Cron
type jobs interface {
// Run 运行
2 years ago
Run(ctx context.Context, info jobs_gorm_model.Task, status int, result string)
2 years ago
// CreateInCustomId 创建正在运行任务
2 years ago
CreateInCustomId(ctx context.Context, config *ConfigCreateInCustomId) error
2 years ago
// CreateInCustomIdOnly 创建正在运行唯一任务
2 years ago
CreateInCustomIdOnly(ctx context.Context, config *ConfigCreateInCustomIdOnly) error
2 years ago
// CreateInCustomIdMaxNumber 创建正在运行任务并限制数量
2 years ago
CreateInCustomIdMaxNumber(ctx context.Context, config *ConfigCreateInCustomIdMaxNumber) error
2 years ago
// CreateInCustomIdMaxNumberOnly 创建正在运行唯一任务并限制数量
2 years ago
CreateInCustomIdMaxNumberOnly(ctx context.Context, config *ConfigCreateInCustomIdMaxNumberOnly) error
// CreateWaitCustomId 创建正在运行任务
CreateWaitCustomId(ctx context.Context, config *ConfigCreateWaitCustomId) error
2 years ago
}