-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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 support for release assets uploading #2267
Add cancellation token support for release assets uploading #2267
Conversation
private class CancellationTestHttpClient : IHttpClient | ||
{ | ||
public async Task<IResponse> Send(IRequest request, CancellationToken cancellationToken) | ||
{ | ||
await Task.Delay(TimeSpan.FromSeconds(1), cancellationToken); | ||
|
||
throw new Exception("HTTP operation was not cancelled"); | ||
} | ||
|
||
public void Dispose() { } | ||
|
||
public void SetRequestTimeout(TimeSpan timeout) { } | ||
} |
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.
Couldn't figure out how to set this up using NSubstitute. Hence, this mock of IHttpClient.
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.
I think this is fine 👍🏻
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.
fuckd up
- [ ]
Codecov Report
@@ Coverage Diff @@
## main #2267 +/- ##
==========================================
+ Coverage 65.97% 66.00% +0.02%
==========================================
Files 553 553
Lines 14435 14437 +2
Branches 844 844
==========================================
+ Hits 9524 9529 +5
+ Misses 4752 4749 -3
Partials 159 159
|
As this is only a spike for octokit#1840, only the POST methods are targeted for now.
As this is only a spike for octokit#1840, only the POST methods are targeted for now.
Spike of octokit#1840 to enable cancellation of release asset uploading.
2ad2839
to
093a30c
Compare
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.
Thanks for the contribution @KatoStoelen!
release_notes: Added cancellation token support for release assets uploading API |
Small spike for #1840
Added an optional cancellation token to
IReleasesClient.UploadAsset(...)
.To make it easier to continue this work, I did the same for all the
Post
methods inIApiConnection
andIConnection
as well.