[MAINT]: Make library Timeout's actually useful #2956
Labels
Status: Up for grabs
Issues that are ready to be worked on by anyone
Type: Maintenance
Any dependency, housekeeping, and clean up Issue or PR
Describe the need
At the moment the timeout support is confusing and inadequate. Take the following method for example:
You might think that this request will timeout after 60 minutes. Actually, this request will timeout after 100 seconds which is default connection timeout used by
HttpClient
. TheReleaseAssetUpload.Timeout
value you see being set above will create a CancellationToken which will cancel the request prematurely (see HttpClientAdapter.cs#L61) but it does not override the HttpClient timeout. And 100 seconds not enough time to upload a larger asset.It is possible to override the HttpClient timeout with
client.SetRequestTimeout(...)
, however this now applies to every request. If ISetRequestTimeout
to 60 minutes, even a simple "list releases" or "create release" request will be allowed to run for 60 minutes before timing out! That is not appropriate.To add insult to injury, if I set the HttpClient request timeout to something large, I can't even specify the cancellation-token style timeout on the short-lived requests so they will timeout in a reasonable timeframe. (because most Octokit requests do not expose the Timeout property)
My options currently are:
Ignore the(can't do this because apparently SetRequestTimeout can not be updated after the first request)ReleaseAssetUpload.Timeout
(because it's useless), and constantly callSetRequestTimeout
before each request with a reasonable time.Set both the(can't do this, because most requests don't even allow you to supply a cancellation token)SetRequestTimeout
andReleaseAssetUpload.Timeout
to comically large values, and create my own cancellation token's for every request with reasonable values.However, in both of the above options it's clear that the built-in timeout logic in Octokit is not fit for purpose.
Code of Conduct
The text was updated successfully, but these errors were encountered: