kfrancis / Chargify2

5 stars 7 forks source link

Expose async methods #3

Closed angularsen closed 9 years ago

angularsen commented 9 years ago

The current library only exposes synchronous methods, meaning the web server is forced to keep a CPU thread twiddling its thumbs while waiting for the Chargify response. Since the thread pool is a limited resource, enough traffic to long running synchronous tasks like these can cause a severe bottleneck.

I recommend refactoring to .NET 4.5 async methods (or .NET 4 with microsoft.bcl.async nuget) so they are async by default and can be called synchronously by .Wait or .Result properties if so desired.

Is there a particular reason you are using RestSharp over .NET's HttpClient? I've personally had a lot of bugs with RestSharp and found its API confusing, and ever since HttpClient was introduced it felt obsolete to me, and you get one less nuget dependency in client code.

kfrancis commented 9 years ago

No particular reason for using RestSharp - just personal experience and speed of implementation. I'll look at adding async, though I've yet to see an implementation example that was simple.

angularsen commented 9 years ago

Neat. I also just wanted to point out the same feature request in the v1 SDK. Do you want me add an issue for it?

kfrancis commented 9 years ago

Sure, though I'm developing a new library that has async baked in rather than refactor the original library.

Kori Sent from my iPhone

On Jun 2, 2015, at 1:31 PM, Andreas Gullberg Larsen notifications@github.com wrote:

Neat. I also just wanted to point out the same feature request in the v1 SDK. Do you want me add an issue for it?

— Reply to this email directly or view it on GitHub.