Even though I set all these configurations to TimeSpan.FromDays(1), hangfire still calls my database every 5 minutes. I see this database call from Azure App Insights.
This is my configuration in program.cs. I am using .NET 6
var options = new SqlServerStorageOptions
{
QueuePollInterval = TimeSpan.FromDays(1),
};
builder.Services.AddHangfire(configuration => configuration
.UseSqlServerStorage(myServicesConnStr, options)
.UseFilter(new AutomaticRetryAttribute { Attempts = 2, DelaysInSeconds = new int[] { 60, 120 } })
);
builder.Services.AddHangfireServer(
options =>
{
options.WorkerCount = 1;
options.SchedulePollingInterval = TimeSpan.FromDays(1);
options.HeartbeatInterval = TimeSpan.FromDays(1);
options.ServerCheckInterval = TimeSpan.FromDays(1);
}
);
app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
StatsPollingInterval = 600000,
Authorization = new[]
{
new HangfireCustomBasicAuthenticationFilter{
User = builder.Configuration.GetSection("HangfireSettings:UserName").Value,
Pass = builder.Configuration.GetSection("HangfireSettings:Password").Value
}
}
});