From 6e12eba356a84839e93ce9f2e92991696f6a1880 Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Fri, 31 Mar 2023 12:34:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=BA=86=E9=87=8D?= =?UTF-8?q?=E5=90=AF=E5=90=8E=E8=AE=A1=E5=88=92=E4=BB=BB=E5=8A=A1=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E5=91=A8=E6=9C=9F=E9=94=99=E8=AF=AF=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#462)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/cron/cron.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/cron/cron.go b/backend/cron/cron.go index 4369aadf0..359969768 100644 --- a/backend/cron/cron.go +++ b/backend/cron/cron.go @@ -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) } } }