Calling Methods with a Delay
Calling Methods with Delay — Hangfire Documentation
Sometimes you may want to postpone a method invocation; for example, to send an email to newly registered users a day after their registration. To do this, just call the BackgroundJob.Schedule method and pass the desired delay:
https://docs.hangfire.io/en/latest/background-methods/calling-methods-with-delay.html
Set the delay with a time span
BackgroundJob.Schedule(
() => Console.WriteLine("Hello, world"),
TimeSpan.FromDays(1));
HangFire Server by default polls the DB every 15 seconds, you can change the interval like this
var options = new BackgroundJobServerOptions
{
SchedulePollingInterval = TimeSpan.FromMinutes(1)
};
var server = new BackgroundJobServer(options);