dropbox-sdk-dotnet icon indicating copy to clipboard operation
dropbox-sdk-dotnet copied to clipboard

An attempt to add cancellation token to async methods (#41)

Open AlirezaMaddah opened this issue 4 years ago • 7 comments

This is an attempt to add cancellation capability to async methods by adding the CancellationToken optional argument as follows:

  1. Changed csharp.py code generator to add the CancellationToken to Async methods.
  2. Changed DropboxRequestHandler to support cancellation while calling HttpClient methods and while performing the retry.
  3. Changed DropboxClient to support cancellation for RefreshAccessToken.
  4. Adding cancellation support to JsonWriter by using the async overloads of Newtonsoft.
  5. I didn't implement the cancellation for JsonReader since it's called after the request is completed.

Checklist

General Contributing

  • [x] Have you read the Code of Conduct and signed the CLA?

Is This a Code Change?

  • [ ] Non-code related change (markdown/git settings etc)
  • [x] SDK Code Change
  • [ ] Example/Test Code Change

Validation

  • [x] Does this code build successfully?
  • [ ] Do all tests pass?
  • [x] Does Stylecop pass?

AlirezaMaddah avatar Jan 21 '21 15:01 AlirezaMaddah

Codecov Report

Merging #209 (0c04841) into main (587b5e4) will decrease coverage by 0.00%. The diff coverage is 17.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #209      +/-   ##
==========================================
- Coverage   10.17%   10.17%   -0.01%     
==========================================
  Files          17       17              
  Lines        1572     1573       +1     
==========================================
  Hits          160      160              
- Misses       1412     1413       +1     
Flag Coverage Δ
unit 10.17% <17.85%> (-0.01%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
dropbox-sdk-dotnet/Dropbox.Api/DropboxClient.cs 0.00% <0.00%> (ø)
...ox-sdk-dotnet/Dropbox.Api/DropboxRequestHandler.cs 0.00% <0.00%> (ø)
dropbox-sdk-dotnet/Dropbox.Api/Stone/Encoder.cs 14.43% <20.83%> (-0.16%) :arrow_down:
dropbox-sdk-dotnet/Dropbox.Api/Stone/JsonWriter.cs 39.06% <29.41%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 587b5e4...a19eca8. Read the comment docs.

codecov[bot] avatar Jan 21 '21 15:01 codecov[bot]

Hi @greg-db Would you please review this PR? I tried to be comprehensive in terms of explaining the details. Please do let me know if anything is unclear. Thanks!

AlirezaMaddah avatar Jan 21 '21 15:01 AlirezaMaddah

Thanks for putting this together! I'm not the right person to do the actual review, but I'll ask the team to review this when they can.

greg-db avatar Jan 21 '21 16:01 greg-db

Thanks, @greg-db! I'm not yet familiar with all Dropboxers! :) I think @connorworley or @rogebrd could help review this.

AlirezaMaddah avatar Jan 27 '21 09:01 AlirezaMaddah

Hi @greg-db @connorworley Is there any update on this PR?

AlirezaMaddah avatar Feb 09 '21 11:02 AlirezaMaddah

@AlirezaMaddah This is still open with the team, but I don't have an update on this right now.

greg-db avatar Feb 09 '21 15:02 greg-db

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
0 out of 2 committers have signed the CLA.

:x: Alireza Maddah
:x: AlirezaMaddah


Alireza Maddah seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 16 '22 21:04 CLAassistant