From 62e55baf58d8abfff5ebb081cc2cf82a94191961 Mon Sep 17 00:00:00 2001 From: Mesut GENEZ Date: Sun, 7 Jul 2024 23:57:56 +0300 Subject: [PATCH] scheduler --- schedule/alotech-call.go | 18 ------------------ schedule/scheduler.go | 12 +----------- 2 files changed, 1 insertion(+), 29 deletions(-) delete mode 100644 schedule/alotech-call.go diff --git a/schedule/alotech-call.go b/schedule/alotech-call.go deleted file mode 100644 index 2cc3686..0000000 --- a/schedule/alotech-call.go +++ /dev/null @@ -1,18 +0,0 @@ -package schedule - -import ( - "log" - "time" - - "github.com/mstgnz/cronjob/config" -) - -func AlotechCall() { - config.IncrementRunning() - defer func() { - config.DecrementRunning() - }() - log.Println("running AlotechCall") - time.Sleep(time.Second * 70) - log.Println("finish AlotechCall") -} diff --git a/schedule/scheduler.go b/schedule/scheduler.go index 543da7e..359e83a 100644 --- a/schedule/scheduler.go +++ b/schedule/scheduler.go @@ -9,16 +9,6 @@ import ( "github.com/robfig/cron/v3" ) -// This application utilizes a database locking mechanism to prevent duplicate cronjob tasks -// when running multiple instances in a Kubernetes (k8s) environment. - -// The instance that first adds a record to the schedule_logs table will be the one triggering -// the cronjob task. Subsequent instances won't be able to create a new record due to an existing one, -// resulting in an error and preventing them from executing the task. -// The microsecond differences between instances will automatically facilitate the locking mechanism. - -// Nevertheless, it is strongly advised for users of this project to establish an additional control -// mechanism on their own systems. func CallSchedule(c *cron.Cron) { // set location loc, err := time.LoadLocation("Europe/Istanbul") @@ -31,7 +21,7 @@ func CallSchedule(c *cron.Cron) { // Alotech Call - every night at 23:59 if _, err = c.AddFunc("* * * * *", func() { config.ShuttingWrapper(func() { - AlotechCall() + // todo }) }); err != nil {