Skip to content

Resilient startup feature not working as expected (still blocking the main API app) #418

@Cfun1

Description

@Cfun1

I have faced some issues related to the newly added feature resilient startup: #415.

  1. Scenario a/: db is down, app starts, app is not responsive (not accepting HTTP requests) until following line is logged: "Starting Hangfire Server using job storage: 'PostgreSQL Server:" (I guess once max retries reached?)
  2. Scenario b/: If in addition I am using the dashboard app.MapHangfireDashboard("/hangfire"), then this whole resiliency won't be effective, the app will crash as before, I guess after max retry attempts reached?

My setup, running within an apsnet core project:

  services.AddHangfire((provider, config) =>
 {
     var autoRetryPolicy = new AutomaticRetryAttribute {
		 ...
         OnAttemptsExceeded = AttemptsExceededAction.Fail
     };
     config.UseFilter(autoRetryPolicy);

     config.UsePostgreSqlStorage(c => c.UseNpgsqlConnection(connectionString), new PostgreSqlStorageOptions()
     {
         PrepareSchemaIfNecessary = true,
         AllowDegradedModeWithoutStorage = true,  
         StartupConnectionMaxRetries = 3,
         StartupConnectionBaseDelay = TimeSpan.FromSeconds(2),  
         StartupConnectionMaxDelay = TimeSpan.FromSeconds(5),

		//...QueuePollInterval, InvisibilityTimeout, JobExpirationCheckInterval, CountersAggregateInterval 
     }); 
 });

 services.AddHangfireServer((provider, options) => { //SchedulePollingInterval, Queues, WorkerCount, ServerCheckInterval  
 });
 .... 
 app.MapHangfireDashboard("/hangfire");
//... register recuring jobs 

Is the behavior described here expected by the initial implementation of this feature? or there is something wrong in my setup? or does the resilient implementation needs a fix/improvement? Thanks!

Ps: Don't you think it is worth considering adding some logging? Regarding resiliency logic kicked-in, failed after max attempts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions