Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpClient and using not working well in .NET core #77

Open
meghuizen opened this issue Apr 22, 2022 · 2 comments
Open

HttpClient and using not working well in .NET core #77

meghuizen opened this issue Apr 22, 2022 · 2 comments

Comments

@meghuizen
Copy link

It's about the following code:

using (var client = new HttpClient())

And see the following article for an explanation on this:
https://www.aspnetmonsters.com/2016/08/2016-08-27-httpclientwrong/

But using a singleton (via a static) can also have issues, like:
https://byterot.blogspot.com/2016/07/singleton-httpclient-dns.html

Since with this SDK, you can't really rely on Dependency Injection, I would prefer that all HttpClients, this SDK is using, can be injected and configured with Dependency Injection (which deals with the cleanup as well) and otherwise set 1 HttpClient per instance of the API objects.

@Arpit-Sharma-USC
Copy link
Contributor

Hi @meghuizen We are going to move away from this and start to use the Files Service upload hopefully soon, this will solve any such issue with the current method as well. We are awaiting on other teams to give the greenlight to merge the PR we have ready for this.

@meghuizen
Copy link
Author

Hi @Arpit-Sharma-USC thanks for the heads-up on this.

I've looked into the branch and I see you're fully going away from the indirect upload to S3 storage to a more direct approach. Looks good. This makes it a lot easier and more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants