Closed michaelhkay closed 2 months ago
I note that ResourceAccess.cs creates a new HttpClient object on each resource request, whereas the recommended advice is to create a shared HttpClient object and use it repeatedly: see https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-net-http-httpclient
If you instantiate an HttpClient class for every request, the number of sockets available under heavy loads will be exhausted. This exhaustion will result in SocketException errors.
I note that ResourceAccess.cs creates a new HttpClient object on each resource request, whereas the recommended advice is to create a shared HttpClient object and use it repeatedly: see https://learn.microsoft.com/en-us/dotnet/fundamentals/runtime-libraries/system-net-http-httpclient