Automatic retry when job is not completed yet

sql-server
Tags: #<Tag:0x00007f8b99cd5998>

#1

I have a long-running process. In some cases it seems that Hangfire attempts a retry of the job when the process is not complete yet. [AutomaticRetry(Attempts = 0)]

from log i find the job running but The same jobid also ran once


#2

Hi ,
Did you check the InvisibilityTimeout options the default value is 30 minutes, after 30 minutes the job is requeued to another worker. You have to change the InvisibilityTimeout to higher if you want you job to not timeout and get processed by another worker.

services.AddHangfire((isp, config) =>
{
   config.UsePostgreSqlStorage(configuration.HangfirePostgresConnectionString, 
       new PostgreSqlStorageOptions()
       {
           //change this
           InvisibilityTimeout = TimeSpan.FromHours(3) 
       });
});

this is an example for PostgreSQL storage .