Hello,
I’m trying to implement HangFire on a dedicated web API based on Swagger (Swashbuckle) and I have an issue regarding multiple calls to Hangfire.
I want to execute a job on almost 9000 nodes and to do that I’m using a parallel loop like this:
Parallel.For(0, 5000, new ParallelOptions { MaxDegreeOfParallelism = Environment.ProcessorCount * 5 }, i =>
{
var jobId = BackgroundJob.Enqueue(() => new winRM().Test(node[i].ToString());
});
I have this kind of error after a few seconds:
The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
I don’t know where it come from (maybe SQL max connections) but when I try with a few nodes (2) it works like a charm.
PS: I’m new in C# development so sorry if this is a noob question:)
Thank you.