Xero-NetStandard icon indicating copy to clipboard operation
Xero-NetStandard copied to clipboard

Use static HttpClient to avoid resource exhaustion

Open TOuhrouche opened this issue 4 years ago • 1 comments

Using non-static http client causes every API instance to consume a new TCP connection. This can quickly exhaust server bandwidth and cause crashes and hangs. More on this here: https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

https://github.com/XeroAPI/Xero-NetStandard/blob/b7bc7f2f1dd896db6ef25a73c508f3f561a30ff7/Xero.NetStandard.OAuth2Client/src/Client/XeroClient.cs#L19

TOuhrouche avatar Aug 08 '21 08:08 TOuhrouche

@JRising-Xero is there any reason this hasn't been addressed? Using a non-static HttpClient is bad practice and making this change would be pretty simple. Happy to do a PR if that's preferred?

ThirstyJarek avatar Dec 02 '22 04:12 ThirstyJarek