Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DuplosFidibuss opened this issue Oct 30, 2024 · 0 comments

Comments

@DuplosFidibuss
Copy link

Version

Hangfire 1.8.14

Storage package

Hangfire.InMemory 0.10.3 and 1.0.0

Configuration logic

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant