feat: add random delay

This commit is contained in:
engigu
2026-03-02 18:29:07 +08:00
parent 42ac0f4acb
commit d8f1b8b50c
13 changed files with 114 additions and 37 deletions
+5
View File
@@ -50,6 +50,7 @@ type Task struct {
AgentID *uint `json:"agent_id" gorm:"index"` // Agent ID,为空表示本地执行
RetryCount int `json:"retry_count" gorm:"default:0"` // 失败重试次数
RetryInterval int `json:"retry_interval" gorm:"default:0"` // 失败重试间隔(秒)
RandomRange int `json:"random_range" gorm:"default:0"` // 随机延迟范围(秒)
Enabled bool `json:"enabled" gorm:"default:true"`
RunningGo string `json:"running_go" gorm:"type:text"` // 正在运行的 go routine id 数组 (JSON)
LastRun *LocalTime `json:"last_run"`
@@ -103,6 +104,10 @@ func (t *Task) GetSchedule() string {
return t.Schedule
}
func (t *Task) GetRandomRange() int {
return t.RandomRange
}
// TaskLog 代表任务执行的日志记录
type TaskLog struct {
ID uint `json:"id" gorm:"primaryKey"`