Multiple httpClients created when using multiple sub- accounts in sendgrid
Issue Summary
When using multiple sendgrid subaccounts in web services, you might need to create a sendgrid object per web request. Sendgrid client does not utilize the same HTTP client and keeps on creating them per object. Since the application URL is the same, we could limit the HTTP client per URL by using a static instance. In this scenario, the sendgrid client creates throttling in applications.
Steps to Reproduce
- Create an asp.net web api.
- Create a sendgrid client per web request with different credentials each time.
- The application will throttle.
The client dll should create a single instance of HTTP client and this would work in the above scenario. In our application, there are hundreds of sendgrid subaccounts and even caching hundreds of Http clients is also not a feasible solution.
Technical details:
- sendgrid-csharp Version: master (v9.10.0)
- Platform (ASP.NET webapi)
- .NET Version: 4.5.2
Hello @nitinmuteja,
Thank you for taking the time to highlight this limitation of our SDK. I like your suggestion and have added it our backlog and opened it up to the community for a PR.
With Best Regards,
Elmer
#839 combined with #904 fixes this, your proposed usage will be fully supported once those PRs are merged.
Since there has been no activity on this issue since March 1, 2020, we are closing this issue. Please feel free to reopen or create a new issue if you still require assistance. Thank you!