HangfireIO / HangfireIO/Hangfire

Problem with a job that is enqueued multiple times on azure web app

Open
#2,102 1 comment 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

I have a job that is defined like this:
```
RecurringJob.AddOrUpdate("Elastic_cleanup",
e => e.DeleteInvalidDocuments(null!, CancellationToken.None), "* 3 * * *");
```
My hangfire setup in program.cs looks like this:
```
builder.Services.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseConsole()
.UseSqlServerStorage(builder.Configuration.GetConnectionString("AddressDatabase"))); ;

builder.Services.AddHangfireServer();

app.UseHangfireDashboard("/hangfire", new DashboardOptions
{
Authorization = new[] { new HangfireAuthorizationFilter() }
});

```
The HangfireAuthorizationFilter is just a IP limiter.

I am running the latest versions of hangfire and hangfire.sqlserver.

My classes are injected as Transient

`builder.Services.AddTransient();`

I only have one server:
![image](https://user-images.githubusercontent.com/2285823/194247235-e3135748-b9d3-49c7-bd83-cd53a068c39d.png)

I only have one instance of the web app in Azure:
![image](https://user-images.githubusercontent.com/2285823/194247447-992b06be-b22f-4902-8a00-e392300404da.png)

Every morning my queue looks like this:
![image](https://user-images.githubusercontent.com/2285823/194246391-b51bc865-d228-430e-a938-1ec5767c3012.png)

Have I setup anything wrong or is this a bug ?
I am using the same setup other places, where I don't have any issues.
I hope you can help me.

Contributor guide

Open the contributing guide

Research direction

Start in Program.cs with the RecurringJob.AddOrUpdate call, AddHangfireServer registration, and UseSqlServerStorage configuration. Reproduce the recurring job behavior in the Azure web app setup shown, then inspect the queue and server configuration to determine whether repeated enqueueing is expected or indicates a configuration problem. Done means documenting the cause and the required setup change or confirming a reproducible Hangfire bug.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp, sql
Domain
backend, cloud, distributed-systems
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.