HangfireIO / HangfireIO/Hangfire.InMemory

Jobs are always removed after one day, regardless of the MaxExpirationTime value

Open
#16 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
92
Forks
22
PR merge metrics
No merged PRs in 30d

Description

### Version
Hangfire 1.8.14

### Storage package
Hangfire.InMemory 0.10.3 and 1.0.0

### Configuration logic
```csharp
services.AddHangfire(configuration => configuration
.SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
.UseSimpleAssemblyNameTypeSerializer()
.UseRecommendedSerializerSettings()
.UseInMemoryStorage(new Hangfire.InMemory.InMemoryStorageOptions { MaxExpirationTime = null})
);

services.AddHangfireServer(options =>
{
options.Queues = ...; // company-specific code
options.WorkerCount = 1;
});

services.AddHangfireServer(options =>
{
options.Queues = ...; // company-specific code
options.WorkerCount = 1;
});

services.AddHangfireServer(options =>
{
options.Queues = ...; // company-specific code
options.WorkerCount = 1;
});
```

### Custom job filters
None

### Problem
According to the documentation in the C# code the `MaxExpirationTime` attribute should overwrite any other job retention behaviour configured. Since we do not want the jobs to be removed at all until we shut down the program (RAM is not so much a concern in our case) we first tried to set the value of this attribute to `System.TimeSpan.MaxValue` and afterwards to `null` which should disable the automatic deletion according to the GitHub documentation. In both cases the jobs are still removed after 1 day. In the dashboard we get the following phenomenon:
image
That is, the counter on the left side displays 12 jobs (and that is the right number), but 9 of them occurred more than 24 hours before the screenshot was taken, so they are no longer listed in the job list.
If the expiration time behaviour can be turned off by setting the attribute to `null`, we expect it to behave this way and not delete any jobs while the program is running.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.