From 1747b48b2788639f593dcad28fbf2cd101018620 Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Fri, 25 Mar 2022 14:26:17 +0700 Subject: [PATCH 1/2] config-cron-with-second --- schedule.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/schedule.go b/schedule.go index 9728844..e55cf20 100644 --- a/schedule.go +++ b/schedule.go @@ -24,7 +24,7 @@ type Scheduler struct { // New ... func newSchedule(jobs ...*Job) *Scheduler { l, _ := time.LoadLocation("Asia/Ho_Chi_Minh") - c := cron.New(cron.WithLocation(l)) + c := cron.New(cron.WithSeconds(), cron.WithLocation(l)) return &Scheduler{ cron: c, @@ -47,7 +47,7 @@ func (s *Scheduler) startSchedule() { func initSchedule() { jobs := []*Job{ { - Spec: "*/30 * * * * *", + Spec: "*/ * * * *", Name: "Start job sync data to service appier", Cmd: SyncToService{}.syncData, }, From 46f77e3292c8ecfd1680ecc0cba372076077cc0f Mon Sep 17 00:00:00 2001 From: Minh Nguyen Date: Fri, 25 Mar 2022 14:27:28 +0700 Subject: [PATCH 2/2] fix spec cron --- schedule.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schedule.go b/schedule.go index e55cf20..b73eb48 100644 --- a/schedule.go +++ b/schedule.go @@ -47,7 +47,7 @@ func (s *Scheduler) startSchedule() { func initSchedule() { jobs := []*Job{ { - Spec: "*/ * * * *", + Spec: "*/30 * * * * *", Name: "Start job sync data to service appier", Cmd: SyncToService{}.syncData, },