OdyseeTeam / odysee-api

API server for Odysee
https://odysee.com
MIT License
228 stars 49 forks source link

app/publish: introduce http retries on fetchFile #365

Closed rnd closed 3 years ago

rnd commented 3 years ago

This allow us to retry http operation on fetchFile if the failure was due to network/connections errors or any configurable policy defined on retryPolicy func.

Fixes #349

rnd commented 3 years ago

Will retryablehttp �handle disconnects and timeouts while reading remote files? They are usually quite large.

if you mean server timeout? yep, as long as the server return the timeout error with the correct status code (504) it will fall into the retryPolicy and we will retry it.

as for server disconnects, this too fall into the network errors, i added one more test case to show this. https://github.com/lbryio/odysee-api/pull/365/files#diff-6d285ed7d9855c047cfd3349b168780fc554e8f191e6c33cbb77c431c89398c4R319-R342

anbsky commented 3 years ago

I meant errors while we're at the io.Copy stage. What if the server goes away midway into a 5GB file?