jstaf / onedriver

A native Linux filesystem for Microsoft OneDrive
GNU General Public License v3.0
1.96k stars 96 forks source link

Fix timeout on downloading large file #272

Closed EwenBara closed 2 years ago

EwenBara commented 2 years ago

The http client have a global timeout to 15s. I replace it with a finer configuration to avoid timeout on http body reading. Timeout in my commit can be changed if needed but I think these values are not bad in case of slow connection.

jstaf commented 2 years ago

Thanks - this is a great contribution! I think if you implement the change requested here it will solve #98 as well.

EwenBara commented 2 years ago

Thanks - this is a great contribution! I think if you implement the change requested here it will solve #98 as well.

It's more complicated for #98. In case of download file, our request are small and it's received quickly by the api. And the response start by not big header. So timeouts are not reached.

But, for upload we can send big sized data, and api wait to receive request body completly before respond. The time to send datas can be slow (connection issue?). So the risk to reach a timeout on upload is greater than download.

One solution (if permitted by api) is to send smaller chunk in case of unstable or slow connection, or on retry in case of failure.

jstaf commented 2 years ago

Right now the largest requests onedriver will send for uploads is 10MB (it does it as part of a multipart upload). Really the reason to increase the timeouts for #98 is that sometimes Microsoft's servers actually time out during periods of high activity, and by increasing the timeout to 30s we are giving them longer to respond (we also do retry things with an exponential backoff if things are slow).

jstaf commented 2 years ago

If increasing the global timeout is good for you, you can close this request.

Going to increase the global timeout in a different PR.