-
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
Set the DefaultTimeout with the Connection #587
Conversation
Putting this to [WIP] until I get feedback that this approach feels right... |
I'm not hearing any objections from the crowd on this one? Is this thing on? |
Should we allow changing it after the |
Setting the timeout for all requests is ok, but I think it would be more useful to set a timeout for a specific upload call, as it may be significantly larger than the default for other calls. Also, again specific to uploads, is it worth setting the timeout to null? |
As in overriding a hypothetical
Sure, but what's the harm in doing this globally? I'd love to avoid over-complicating this API, I just wish I had a second example to go alongside uploading assets to say doing it globally is a saner approach.
OK, this one interests me. Perhaps that's the compromise here, so you can do this sort of code:
@distantcam do you keep the |
Typically we keep the client for a few actions, mostly create the draft release + upload assets to that draft. Usually upload timeouts would be large, so setting it globally I don't want to wait 60 minutes to find out the release creation was the one that timed out. Being able to change the default between calls is ok, but it just feels a bit icky to me. HttpClient.Timeout supports a value of Infinite so that would work instead of null. Also, here's where I'm using Octokit. https://github.com/Particular/GitHubReleaseNotes/blob/master/src/App/Program.cs |
@distantcam fair enough, I've got a couple of ideas for isolating it just to |
Alright, how does that test look and feel? |
That ContinueWith gives me the heebie jeebies. |
Yeah, it's Not The Best. Open to other suggestions to contain that side-effect. I don't want to be passing the timeout all the way through for the |
25b4f44
to
098e9e3
Compare
Ok, so I threw away all that previous work and went down the path of just making @haacked @distantcam let me know how that feels |
@@ -1,4 +1,4 @@ | |||
using System; | |||
using System; |
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.
Whitespace.
🐒 |
return Run<T>(request, cancellationToken); | ||
} | ||
|
||
Task<IResponse<T>> SendData<T>( |
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.
The two SendData methods are very similar. I can see a modified-one-but-not-the-other error in your future.
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.
Fiiiiiiine I'll merge those together better
🍎 |
a03f047
to
987282d
Compare
Some of the integration tests are failing, but I'm gonna take this in because I no longer trust my CI setup 😢 |
Set the DefaultTimeout with the Connection
So #554 is one option for addressing the timeout issues in #567, but as @haacked and I discussed it'd be nicer to avoid the static property. So this is my proposal to satisfy that in the simplest possible way.
Connection
is where we create theRequest
objects, before passing them to theHttpClientAdapter
- so why not configure it there?This adds a new
ctor
toGitHubClient
where you can set this:I don't believe anyone else is using more than the default one, but I'm sure I'll hear about them sooner rather than later if they also want this...
cc @distantcam @arakis for feedback