-
Notifications
You must be signed in to change notification settings - Fork 1
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
Implement async/await approach #18
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
Co-authored-by: Stanislav Bedunkevich <[email protected]>
Is it idiomatic in C# to append Async to all the method names? I would think the method signature would be sufficient to indicate that it is async. |
Is there a reason to make all client functions async ? If so let's keep the original functions names otherwise I think |
@NRHelmi https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/. It's the idiomatic way of dealing with any network requests. Kind of like a Future in Java or Promise (or async/await) in JS. |
Yeah, it is @larf311 @NRHelmi. For example, AWS SDK follows the same approach: |
That is because essentially all SDK methods do end up doing an HTTP request. Now we need to make it async so that the thread management part of .Net could take care of those threads for us and be less burdened. The link Trevor posted above also describes that in more detail. |
Fair enough, is it also required to have all async function renamed to |
Well, it's the common practice in the C# world :) I added a link to the AWS SDK where they also stick to the same approach, even though Java SDK may not have the Async postfixes. I am not sure we need to have the method names exactly matching across all of the SDKs, as some languages have practices like this one and we'll likely to end up deviating from that. Moreover, we are already kind of, if we consider the various PascalCase, snake_case and camelCase diffs we have in place :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks ❤️
I think the AWS SDK has *Async b/c it also has non-async versions. That being said, the Google BigQuery API also does the same thing (offers both sync & async) so I guess we should do it in case we end up offering both. |
Ok, so for the execute functions, we renamed
Fair enough 🤔 Better than |
@larf311 yeah, it seems they both do, right. Although the sync version is usually a wrap around its async version like:
I agree if we need to provide a sync version later for all of the methods in SDK it would be easier done having the async versions in place (this PR). I am kind of unsure we need that though, as users can write Do you have any objections against merging this PR as it is now? |
No, looks good. 👍 |
Imlements async/await approach using
System.Threading.Tasks
. All methods are renamed accordingly, addingAsync
postfix to indicate that they implement async/await approach.