Closed onlyann closed 7 years ago
Hey @onlyann,
Thanks for the PR, and sorry for taking so long to follow up on it. Were you able to run the tests after making these changes? This looks on the surface like a breaking change, which means that we would have to wait until the next major version to release this.
Hi @sdcoffey
Tests run fine on my end. Can you elaborate as to why you believe this is a breaking change? None of the contracts have changed and exception handling should be transparent.
At first glance, changed method signatures seem like breaking changes. I'm no C Sharp expert though, so I could be wrong. Can you explain the motivation behind this change and what the tangible benefits are?
the async
keyword does not modify the signature of the methods.
This issue was already discussed in #32. It was well described in one of the replies:
Concurrency is not the same as async. An ASP.NET application is already naturally concurrent. Async/await improves scalability and throughput--threads do not block while waiting for external processes, e.g. the response from your server, and are free to handle other requests. I'd like to talk to you more about this. Not supporting async means that you are effectively artificially limiting the performance of your clients' applications.
At the moment, only a few IO calls are performed asynchronously which this PR tries to fix. The tangible benefits are that web applications consuming Braintree through this SDK can achieve better throughput because ASP.NET threads don't get unnecessarily blocked.
Mainly, the HTTP Request and Response to Braintree servers are blocking the threads before this PR.
For instance, request.GetResponse
is blocking while request.GetResponseAsync
isn't.
Please add these ConfigureAwaits() -- we're experiencing deadlocks on ASP.NET using the Async methods.
Thanks!
Thanks for the contribution! We'll put this in our next release.
This pull request improves the implementation of the asynchronous operations for .NET 4.5 in the following ways:
async
await
overhead when they are not necessary