3

In our system hangfire launch one time per hour an API method that runs a stored procedure. This SP usually executes 2-3 minutes, but sometimes is can take more than 10.

After some experiments I realised that after 5 minutes hangfire thinks that task is hanged and runs it one more time. And this is up to 5 times.

This causes random problmes hard to detect. Does somebody know it is possible to change this behavior and set default timeout as 20 minutes?

public class MyTask :  BaseTask,  IHangfireTask
{
    public MyTask() 
        : base(0)
    {
    }

    public void ExecuteTask()
    {
        using (var client = GetClient())
        {
            client.SomeWork();
        }
    }
}
  • Redo of stored procedure is not an option :)
  • I can also put my code to Task.Run and make it asynchrone but in this case we'll lose the exceptions.
Vitalii
  • 10,091
  • 18
  • 83
  • 151
  • If I remember correctly this is a limitation you set in the IIS application pool. What's the timeout set to there? – fredrik Feb 13 '17 at 10:24
  • Which version of hangfire are you using? if its < 1.5, your issue might be with the the InvisibilityTimeout (see this SO answer: http://stackoverflow.com/a/33429354/5120854). If not, please state which job storage are you using – Guy Levy Feb 13 '17 at 14:34

0 Answers0