Search code examples
c#hangfire

Hang-fire only executing one job at a time


We have a scheduled job that running for more than two hours . And now other scheduled jobs is adding as Queued , why Hangfire not running that jobs. I set worker count as 3, but still it not executing. Job Details HangFire Details:

Installed on : Windows 2018 R2

Hangfire Version : 1.6.22

DB used : PostgreSQL

Thanks in advance.


Solution

  • Adding more info , that may help others .

    Later i found out that my scheduled job was running multiple times (in every 30 minutes). And all my 3 worker was executing that single job , and there was no free worker to execute pending jobs.

    Looks like this issue is related to this hangfire bug #Bug:130 , #BUG:1197

    this fix is working :

    new PostgreSqlStorageOptions()
           {
               //change this
               InvisibilityTimeout = TimeSpan.FromHours(24) 
           });
    

    But even though i set auto retry to false (by setting Attempts = 0), it was retrying the scheduled job. And it was not even logging that retry even after i setting log event (LogEvents = true). i only got this information only after using this LogEverythingAttribute

    [AutomaticRetry(Attempts = 0, LogEvents = true, OnAttemptsExceeded = AttemptsExceededAction.Fail)]
    

    Is this a other bug in Hangfire ?

    i closing this as maybe issue with hangfire .