fix: 修复了重启后计划任务执行周期错误的问题 (#462)

pull/465/head
ssongliu 2 years ago committed by GitHub
parent 3457b99df6
commit 6e12eba356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -44,13 +44,13 @@ func Run() {
}).Error; err != nil {
global.LOG.Errorf("start my cronjob failed, err: %v", err)
}
for _, cronjob := range cronJobs {
entryID, err := service.ServiceGroupApp.StartJob(&cronjob)
for i := 0; i < len(cronJobs); i++ {
entryID, err := service.ServiceGroupApp.StartJob(&cronJobs[i])
if err != nil {
global.LOG.Errorf("start %s job %s failed, err: %v", cronjob.Type, cronjob.Name, err)
global.LOG.Errorf("start %s job %s failed, err: %v", &cronJobs[i].Type, &cronJobs[i].Name, err)
}
if err := repo.NewICronjobRepo().Update(cronjob.ID, map[string]interface{}{"entry_id": entryID}); err != nil {
global.LOG.Errorf("update cronjob %s %s failed, err: %v", cronjob.Type, cronjob.Name, err)
if err := repo.NewICronjobRepo().Update(cronJobs[i].ID, map[string]interface{}{"entry_id": entryID}); err != nil {
global.LOG.Errorf("update cronjob %s %s failed, err: %v", cronJobs[i].Type, cronJobs[i].Name, err)
}
}
}

Loading…
Cancel
Save