Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

Recurring job execution time is inaccurate

Open Broderick890 opened this issue 1 year ago • 1 comments

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.

Broderick890 avatar Dec 29 '23 08:12 Broderick890

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

  • Hangfire.Core 1.8.9
  • Hangfire.NetCore 1.8.9
  • Hangfire.AspNetCore 1.8.9
  • hangfire.MySqlStoreage 2.0.3
  • Pomelo.EntityFrameworkCore.MySql 8.0.0-beta.2
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);

DaNeubi avatar Jan 28 '24 01:01 DaNeubi