HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.43k stars 1.7k forks source link

[SqlServerStorageOptions] Is it possible to control JobExpirationCheckInterval cron time? #2428

Open samirvarandas opened 4 months ago

samirvarandas commented 4 months ago

var options = new SqlServerStorageOptions { CommandBatchMaxTimeout = TimeSpan.FromMinutes(21), SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), QueuePollInterval = TimeSpan.Zero, UseRecommendedIsolationLevel = true, DisableGlobalLocks = true, SqlClientFactory = SqlClientFactory.Instance, PrepareSchemaIfNecessary = true, EnableHeavyMigrations = false, DeleteExpiredBatchSize = 1000, TryAutoDetectSchemaDependentOptions = true, JobExpirationCheckInterval = TimeSpan.FromDays(1) };

I am setting JobExpirationCheckInterval to 1 day but i have no control about when it will run exactly Is it possible to run this routine daily at 3am? It appears to run on random hours. Does it consider 1 day after the start of the aplication to decide at what time it will run?

I am having issues with a big database full of jobs, and sometimes when it starts my aplication is unable to enqueue jobs due to locks on the SQLServer [Hangfire].Job table.