简体   繁体   English

Hangfire:在 postgres 上打开的连接太多

[英]Hangfire: Too many connections opened on postgres

I'm trying to set up Hangfire (version 1.7.3) on a C# API with Postgres, but I need to limit the number of connections Hangfire uses in Postgres.我正在尝试使用 Postgres 在 C# API 上设置 Hangfire(版本 1.7.3),但我需要限制 Hangfire 在 Postgres 中使用的连接数。

app.UseHangfireServer(config => {
    config.UseServer(2); //that option does't exist for postgres
});

Found proper solution:找到合适的解决方案:

var options = new BackgroundJobServerOptions { WorkerCount = 2 };
app.UseHangfireServer(options);

Connections dropped to 6 from 20+ (crash on heroku).连接数从 20+ 下降到 6(heroku 崩溃)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM