HangfireIO / HangfireIO/Hangfire

Scheduled Jobs not being Enqueued

Open
#2,522 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

We are on Hangfire 1.8.20, we have 19 million tasks in the scheduled queue, almost all of them are due to be ran now. They are not being enqueued fast enough. We have 19 servers * 5 workers each. Occasionally a burst of tasks will go to the enqueue status, and we then process those tasks very quickly, but then it stalls enqueueing more tasks.

Anyway I can get these tasks enqueued? We're days behind on some of these tasks due date.

Our settings:

```
c.UseSqlServerStorage(builder.Config["ConnectionStrings:Hangfire"], new SqlServerStorageOptions
{
CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
QueuePollInterval = TimeSpan.Zero,
UseRecommendedIsolationLevel = true,
UsePageLocksOnDequeue = true,
DisableGlobalLocks = true,
PrepareSchemaIfNecessary = false //Dont try to recreate the tables in production every boot.
});
builder.Services.AddHangfireServer(options =>
{
options.ServerName = Environment.MachineName;
options.Queues = new[] { "default", "x0_web", "x1_mail" };
options.WorkerCount = 5;
options.MaxDegreeOfParallelismForSchedulers = 2;
});```

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start with the reported AddHangfireServer configuration and UseSqlServerStorage options, then trace how scheduled jobs move to the enqueue status under the stated worker and scheduler counts. Done means the enqueueing stall is reproduced and its cause or a verified resolution is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sql
Domain
backend, databases, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.