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

Recurring job stops being executed after approximately 3 days with timezone set to local timezone #2462

Open
DuplosFidibuss opened this issue Oct 30, 2024 · 1 comment

Comments

@DuplosFidibuss
Copy link

DuplosFidibuss commented Oct 30, 2024

Version

1.8.11 and 1.8.14

Storage package

Hangfire.InMemory 0.10.3

Configuration logic

services.AddHangfire(configuration => configuration
    .SetDataCompatibilityLevel(CompatibilityLevel.Version_180)
    .UseSimpleAssemblyNameTypeSerializer()
    .UseRecommendedSerializerSettings()
    .UseInMemoryStorage(new Hangfire.InMemory.InMemoryStorageOptions { MaxExpirationTime = System.TimeSpan.MaxValue})
);

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

By scheduling a task using the following call:

recurringJobManager.AddOrUpdate(<taskId>, <queuePriority>, () => <methodCall>, <taskCron>, new RecurringJobOptions { TimeZone = TimeZoneInfo.Local });

The task is scheduled correctly and runs at the correct time for approximately 3 days. Afterwards it is no longer executed and in the dashboard we get phenomena like this:
image
In English, it is telling us that the next execution is 37 minutes ago which does not really make sense at all.

By omitting the part setting the time zone to the local time zone (that is, using the default time zone configuration UTC) with all other configuration remaining unchanged the task is scheduled and executed correctly for any length of time. Therefore we strongly assume a problem related to the timezone setting when calling the RecurringJobManager.

@odinserj
Copy link
Member

Please try upgrading to the newest Hangfire.InMemory package 1.0.0, this problem was fixed in 0.10.4 as written here – HangfireIO/Hangfire.InMemory#14.

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

2 participants