I am using cron expression for creating a recurring job. I am creating expression to execute every half an hour on 3 days of a week . The execution is correct but the time it starts is not correct. Suppose the creation of job happens at 2 : 16 pm, the job starts executing at 2 : 30 pm . If I configure to execute 2 : 20 also the job starts at 2 : 30 pm which ideally I wanted to start at 2 : 20 and recur every half an hour . Currently I am not finding a way to start at 2 : 25 and recur every half an hour.
Can someone please let me know why is it happening when used a cron expression ? Is there a way to identify this pattern so that I can adjust my execution time. The cron expression is "*/30 * * 1,2 1,2,3"
@cocowalla: I am using sql server as the backend. I am replicating connection string exactly the way it is given in hangfire documentation but not looked at polling. Is there any other reason apart from this?
From the docs, the SQL backend is polled, so start time accuracy may be limited:
One of the main disadvantage of raw SQL Server job storage implementation – it uses the polling technique to fetch new jobs. Starting from Hangfire 1.7.0 it’s possible to use TimeSpan.Zero as a polling interval, when SlidingInvisibilityTimeout option is set.
{
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero
};
GlobalConfiguration.Configuration.UseSqlServerStorage("<name or connection string>", options);```
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With