Closed Cyl18 closed 2 years ago
Well, the point of the client, is to use a single API key. (Which could be handled with multiple instances as well, but that's beside the point)
The problem with creating a new per instance, could be port exhaustion.
But I could redo it to use IHttpClientFactory
, which will handle pooling internally, while still allowing multithreading and avoid port exhaustion. Will work on it during lunch. (Edit: Forgot to turn on my server at home, so can't remote and fix it)
Thanks for notifying me of this though!
in readme.md
consider this code:
it pops out some exceptions like this:
in ApiClient.cs, the _httpClient is static, which means a single instance disposes would affect all existing instances https://github.com/CurseForgeCommunity/.NET-APIClient/blob/05caa75f202a3c483c8abbd65bb3be1dc97a911e/ApiClient.cs#L13 and a static HttpClient would cause extra problems like all ApiClient will use the same ApiKey
i have made a simple pull request to fix this problem :) (#2)