Base solution for your next web application
Open Closed

Configure hangfire server timeout #6518


User avatar
0
ajayak created

Get this erorr in log for long running background job. The job terminated in less than 10 minutes.

Job started at 14:34:21 and server got removed at 14:37:06.

DEBUG 2019-02-20 14:35:46,479 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:35:54,884 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:07,064 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:15,531 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:23,792 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:32,107 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:40,601 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:48,733 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
DEBUG 2019-02-20 14:36:57,167 [51   ] ion.Mg.MgPostInitializationJob - Processing batch
INFO  2019-02-20 14:37:06,442 [chdog] Hangfire.Server.ServerWatchdog           - 1 servers were removed due to timeout

Job class:

public class MgPostInitializationJob : BackgroundJob<MgPostInitializationJobArgs>, ITransientDependency
    {
     // My code here
    }

3 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team

    You can refer to abp's hangfire documentation. https://aspnetboilerplate.com/Pages/Documents/Hangfire-Integration#asp-net-core-integration

  • User Avatar
    0
    ajayak created

    Hi @maliming, I cannot find any way to configure Hangfire server timeout in AspNetZero code.

  • User Avatar
    0
    maliming created
    Support Team

    Try use BackgroundJobServerOptions

    app.UseHangfireServer(new BackgroundJobServerOptions()
    {
    	ServerTimeout = TimeSpan.FromMinutes(10)
    });