Open rnbokade opened 3 months ago
hello, I also have some problem about regist periodic tasks,could u please help me?
my code like this, my normal task is ok, but periodic task is failure, error msg is : "checkAllJobs" Task not registered with this worker.
I don't know which step is wrong.
{
// .....
// 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, // this is normal task, and everything is ok
"checkAllJobs": task.CheckAllJobs, // this is periodic tasks
}
return tasksMap
}
I am building a sensor management system, where in I want to be able to add periodic tasks for polling sensors at specific intervals. however, the web interface would also allow, the user to tweak the polling interval of particular sensor as such. So I want to be able to remove the scheduled job and schedule a new one. How to do this?