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.