go-co-op / gocron

Easy and fluent Go cron scheduling. This is a fork from https://github.com/jasonlvhit/gocron
MIT License
5.66k stars 309 forks source link

[BUG] - Schedule Issue for first days of the month #525

Closed theriverman closed 1 year ago

theriverman commented 1 year ago

Hi,

Describe the bug

I have the following cron configuration: CRON_TZ=Europe/Budapest 30 09 1 * *

According to Crontab.guru it's supposed to trigger on the first day of each month, however, it was just triggered Today (10th of July) which is a 10-day delay.

To Reproduce

Above CRON config is picked up by my application in the following way:

s := gocron.NewScheduler(time.UTC)

for _, reminder := range config.Reminders {
    if reminder.CronRule == "" {
        log.Panicf("no value set")
    }
    log.Printf("registering reminder: %s | %s\n", reminder.Name, reminder.CronRule)
    s.Cron(reminder.CronRule).Do(func() {
        if err = callReminder(reminder, requests); err != nil {
            log.Println(err)
        }
    })
}
// ....
s.StartBlocking()

Version

v1.17.1

Expected behavior

Trigger at the configured time.

Additional context

N/A

Thanks!

JohnRoesler commented 1 year ago

Hi @theriverman I can't recreate the issue. The first thing I would try is upgrading to the latest version. That's a very odd issue and I don't want to guess wildly as to what may have caused it.