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

Add cancellation token parameter to async methods #549

Closed
wants to merge 10 commits into from

Conversation

yj7o5
Copy link

@yj7o5 yj7o5 commented Oct 10, 2020

  • Adds an optional CancellationToken to all the async public methods
  • Update the approvals files for netcore and netframework due to pubic api methods signature changes
  • Fix breaking test due to additional default parameter at certain places

Few notes:

closes #537

@yj7o5 yj7o5 requested a review from slewis74 as a code owner October 10, 2020 06:27
@CLAassistant
Copy link

CLAassistant commented Oct 10, 2020

CLA assistant check
All committers have signed the CLA.

@yj7o5
Copy link
Author

yj7o5 commented Oct 12, 2020

I think for some of those methods that take parameterized array such as:
https://github.com/OctopusDeploy/OctopusClients/pull/549/files#diff-b4563a4a2fe786ba2dd3fa2ccdaef341R19

we can probably leave the old definition as is i.e.:
Task<List<TAccount>> GetOfType<TAccount>(params string[] ids)

and add another one that takes the token (not optional but required) Task<List> GetOfType(CancellationToken token, params string[] ids)`

while remove this signature that I modified it to earlier:
Task<List<TAccount>> GetOfType<TAccount>(CancellationToken token = default, params string[] ids)

This way it doesn't break other codebases. Although its best practice to take token as the last default parameter but not sure how best to get away with this.

@yj7o5
Copy link
Author

yj7o5 commented Oct 15, 2020

@matt-richardson any thoughts on above? and when can this be merged and available for usage once ready. Appreciate any feedback!

@matt-richardson
Copy link
Contributor

@matt-richardson any thoughts on above? and when can this be merged and available for usage once ready. Appreciate any feedback!

Hi @yj7o5 - thanks for the PR. I've passed it onto the right team here to look at. Hopefully they should get to it soon.

As for the param ordering, we could either put the cancellation token first, or add an overload that drops the params part, so it takes an array and a token. Right now I'm not entirely sure... 🤔 Do what you think best and the team will look at it in more detail soon.

@mcasperson
Copy link
Contributor

Unfortunately the QRF team did not have capacity to address this PR. We'll keep the PR open, but unfortunately we can not provide any guidance as to when it will be resolved.

@yj7o5
Copy link
Author

yj7o5 commented Oct 27, 2020

That's fine. Appreciate the response.

@slewis74 slewis74 removed their request for review February 13, 2023 01:15
@rosslovas rosslovas closed this Oct 29, 2023
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

Successfully merging this pull request may close these issues.

Add CancellationToken support on async calls
5 participants