Issue with Recurring jobs on different cadence

I have 4 jobs running under different cadence, 2 are every hour. one every 100 minutes and one every 4 hours. They appear as if they are setup correctly but they all seem to fire every 60 minutes despite how they are configured.

The cron column lists them correctly but they all seem to get fired at the same time. (see screenshot)

i am running version 1.6.14

Here is how i am starting the jobs

RecurringJob.AddOrUpdate(_JOBID, () => MBC_Space_Track_Fix.StartMBCNameFix(), Cron.MinuteInterval(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“mbc_poll_frequency_minutes”])));

RecurringJob.AddOrUpdate(Starz_JOBID, () => StarzSAPJob.StartStarzDMLScan(), Cron.MinuteInterval(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“starz_poll_frequency_minutes”])));

RecurringJob.AddOrUpdate(_JOBID, () => RedboxReportRunner.StartDownloadAndScan(), Cron.MinuteInterval(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“redbox_poll_frequency_minutes”])));

RecurringJob.AddOrUpdate(_JOBID, () => Amazon_Packager.StartPackageCheck(), Cron.MinuteInterval(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“amazon_poll_frequency_minutes”])));

1 Like

I’m getting the exact same issue, did you resolve this yourself ???

I think it is against Cron syntax to use minute values greater than 60.

If you look at https://crontab.guru/#/100_*_ next executions, it would be exactly every hour.

!! thanks. That looks to have solved it.

yes, piece of summer solved it below. I will post some more information as a reply to the main thread.

pieceofsummer provided the answer here. The Hangfire Cron class is literal in the translation to a cron task. So if you specify 100 minutes or more as a minutely task this will essentially just be 60 minutes because the maximum number of minutes that can be set is 60. So basically everything greater than 60 is evaluated as 60 and the class is not smart enough to turn it into an hourly job. To solve this I just used Cron.HourInterval instead on minutely and divided by 60.

Keep in mind that if you divide an integer by 60 and pass it in as an integer it will be rounded. If you want to run jobs more than one hour and at a cadence not divisible by 60 you will likely need to specify your Cron string literal instead of using the cron class. There are numerous Cron string generators online that I have found which would be useful for this case.

RecurringJob.AddOrUpdate(_JOBID, () => MBC_Space_Track_Fix.StartMBCNameFix(), Cron.HourInterval(Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings[“mbc_poll_frequency_minutes”]) / 60));