HangfireIO / HangfireIO/Hangfire
[SqlServerStorageOptions] Is it possible to control JobExpirationCheckInterval cron time?
- Dominant language
- C#
- Stars
- 10.1k
- Forks
- 1.8k
- Avg merge
- 1h 19m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
Research direction
Start with SqlServerStorageOptions and the JobExpirationCheckInterval setting, then trace the expiration-check routine and its interaction with the [Hangfire].Job table in SQL Server. Determine whether a daily 3am schedule can be supported and verify that the resulting behavior avoids unexpected locking during enqueue operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- backend, databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100