Hangfire cron expression not matching next execution time


#1

I’m trying to enqueue a new recurring job that runs every minute, however on the dashboard the next execution time does not match. Any ideas?

string cronExpression = “0/1 * * * *”;

RecurringJob.AddOrUpdate(newJob.Name, () => _schedulingEngine.SendCommands(JobCancellationToken.Null, newJob), cronExpression);


#2

I think you’re looking for “* * * * *”. Also, there’s a helper class that will help you construct your cron expressions in the Hangfire namespace Cron class. So, you could do this:
RecurringJob.AddOrUpdate(newJob.Name, () => _schedulingEngine.SendCommands(JobCancellationToken.Null, newJob), Cron.Minutely());