kraken-net icon indicating copy to clipboard operation
kraken-net copied to clipboard

Timeout during upload due to default HttpClient.Timeout property

Open Shane32 opened this issue 4 years ago • 0 comments

HttpClient.Timeout defaults to a 100 second timeout. I have a reproducible problem where this timeout period is not long enough for Kraken to finish processing the request. It could be due to throttling; I am not sure. However, if I use reflection to set the timeout of the private HttpClient _client field on the Connection object to System.Threading.Timeout.InfiniteTimeSpan, then the request completes successfully.

This is a reproducible problem given the same inputs. I suggest that you set the Timeout property to infinite by default, or add an argument for a custom timeout value on the Connection.Create static method. Keep in mind that since there are already overloads of the conversion methods that accept a CancellationToken, a custom timeout can be implemented, as described by MS's documentation:

See https://docs.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-5.0 :

The same timeout will apply for all requests using this HttpClient instance. You may also set different timeouts for individual requests using a CancellationTokenSource on a task. Note that only the shorter of the two timeouts will apply.

Shane32 avatar Nov 15 '20 23:11 Shane32