Search code examples
c#postgresql.net-corehangfire

Hangfire: too many connections opened


We are using Hangfire in production and turns out that we literally reach the database connections max limitation.

We have about 45 connections for just hangfire which seems a bit too much for just maintaining some long task running jobs.

I am wondering whether there is anything that can be done to change the number of connections, however, I can't find anything in the configuration providing such configuration.


Solution

  • You could try to reduce the number of workers as it is described here:

    app.UseHangfire(config =>
    {
        //tell hangfire to only use 2 workers
        config.UseServer(2);
    });