Closed xiaoz194 closed 1 week ago
I have some normal tasks,and one peridic task, how to regist peridic task? could u please support a completely code example? thanks!
my code like this, my normal task is ok, but periodic task is failure, error msg is : task "checkAllJobs" not regist.
{ // ..... // regist tasks tasksMap := initAsyncTaskMap() err = server.RegisterTasks(tasksMap) // ok // regist periodic task signature := &tasks.Signature{ Name: "checkAllJobs", } if !server.IsTaskRegistered("checkAllJobs") { logutil.G(ctx).Infof("checkAllJobs task not regist") err = server.RegisterPeriodicTask("1 * * * ?", "checkAllJobs", signature) // failed err: task not register } return server, err } func initAsyncTaskMap() map[string]interface{} { tasksMap := map[string]interface{}{ "produce": task.Produce, "checkAllJobs": task.CheckAllJobs, // this is periodic tasks } return tasksMap }
I have some normal tasks,and one peridic task, how to regist peridic task? could u please support a completely code example? thanks!
my code like this, my normal task is ok, but periodic task is failure, error msg is : task "checkAllJobs" not regist.