HangfireIO / Hangfire

An easy way to perform background job processing in .NET and .NET Core applications. No Windows Service or separate process required
https://www.hangfire.io
Other
9.44k stars 1.71k forks source link

Recurring job execution time is inaccurate #2341

Open Broderick890 opened 10 months ago

Broderick890 commented 10 months ago

image

My config:

var options = new SqlServerStorageOptions { SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5), QueuePollInterval = TimeSpan.Zero };

builder.Services.AddHangfire(configuration => configuration.SetDataCompatibilityLevel(CompatibilityLevel.Version_180) .UseSimpleAssemblyNameTypeSerializer().UseRecommendedSerializerSettings() .UseSqlServerStorage(schedulerSetting.ConnectionString, options) .UseFilter(new AutomaticRetryAttribute { Attempts = 0 }) .UseFilter(new DisableConcurrentExecutionAttribute (schedulerSetting.ConcurrentExecutionTimeoutSeconds)) .UseSerilogLogProvider() );

Cron: "59 *"

hangfire version: image

The program's local time is 4 seconds faster than the database; Each execution of the schedule is slower than the last time;Please help please.

DaNeubi commented 9 months ago

Can confirm I'm running into the same issue. Recurring Job is set to Cron.Minutely heidisql_okCtXoH0IM

Or heidisql_72SjMTkhBu

Using : .NET Core 8

builder.Services.AddHangfire(config =>
{
    config.SetDataCompatibilityLevel(CompatibilityLevel.Version_180);
    config.UseSimpleAssemblyNameTypeSerializer();
    config.UseRecommendedSerializerSettings();
    config.UseStorage(
        new MySqlStorage(
            connectionString,
            new MySqlStorageOptions
            {
                JobExpirationCheckInterval = TimeSpan.FromHours(1),
                CountersAggregateInterval = TimeSpan.FromMinutes(5),
                PrepareSchemaIfNecessary = true,
                DashboardJobListLimit = 25000,
                TransactionTimeout = TimeSpan.FromMinutes(1),
                TablesPrefix = "Hangfire",
                QueuePollInterval = TimeSpan.FromSeconds(10)
            }
        )
    );
});

While using QueuePollInterval = TimeSpan.Zero The application is crashing with the error that this cannot be Zero

RecurringJob.AddOrUpdate<CheckStatus>(jobName, c => c.CheckHealthStatus(jobName), Cron.Minutely);