add new uuid

main task/v1.0.10
git 2025-12-20 00:49:24 +08:00
parent f5a1158e64
commit a80abffc26
Signed by: git
GPG Key ID: 3F65EFFA44207ADD
1 changed files with 3 additions and 0 deletions

View File

@ -29,6 +29,7 @@ import (
"github.com/RichardKnop/machinery/v2/log" "github.com/RichardKnop/machinery/v2/log"
"github.com/RichardKnop/machinery/v2/tasks" "github.com/RichardKnop/machinery/v2/tasks"
"github.com/RichardKnop/machinery/v2/utils" "github.com/RichardKnop/machinery/v2/utils"
"github.com/google/uuid"
"github.com/robfig/cron/v3" "github.com/robfig/cron/v3"
irevoker "git.ifooth.com/common/pkg/task/revokers/iface" irevoker "git.ifooth.com/common/pkg/task/revokers/iface"
@ -290,6 +291,8 @@ func (m *TaskManager) registerScheduleTask(spec string, task *types.Task) error
return return
} }
// 定时任务每次生成新的任务ID
task.TaskID = uuid.NewString()
err = m.Dispatch(task) err = m.Dispatch(task)
if err != nil { if err != nil {
log.ERROR.Printf("periodic task failed. task name is: %s. error is %s", task.TaskName, err.Error()) log.ERROR.Printf("periodic task failed. task name is: %s. error is %s", task.TaskName, err.Error())