How can I add date to the HangFire task? For example, this code adds 7 days:
BackgroundJob.Schedule(
() => Console.WriteLine("Reliable!"),
TimeSpan.FromDays(7));
But what if I need to run task in specific date?
Starting from Mar 8, 2022 Hangfire is owned by Hangfire OÜ (private limited), an Estonian company.
DashboardLatency.PNG890×113 3.68 KB. yngndrw August 20, 2015, 7:22pm #3. Latency is the amount of time between the job being created and the start of the processing of the job: github.com.
The call to AddOrUpdate method will create a new recurring job or update existing job with the same identifier.
If the year doesn't matter, you can use cron expression for this purpose. Most default cron implementations (like NCrontab used by Hangfire) don't include the year field.
BackgroundJob.Schedule(
() => Console.WriteLine("Reliable!"),
"30 4 27 6 *");
This job will be executed at 4.30am on the 27th of June every year.
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