deepgram/deepgram-dotnet-sdk

Use of HttpClient could cause socket starvation on server

Closed this issue · 1 comments

What is the current behavior?

Code is directly creating an instance of HttpClient.

What's happening that seems wrong?
In high load server situations this can cause socket starvation

Steps to reproduce

This is a known problem with HttpClient, no reproduction steps needed.

Solution

Use HttpClientFactory to create instances of an HttpClient.

More info: https://learn.microsoft.com/en-us/dotnet/architecture/microservices/implement-resilient-applications/use-httpclientfactory-to-implement-resilient-http-requests