Skip to content
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

upload: add connection exceptions to upload retry protocol #1031

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ashwoods
Copy link

Addresses our intermittent upload issues as described that #1017 was initially trying to address.

Although we are mainly running into "connection reset by peer" exceptions, I've added connection timeouts, and I'd consider adding a sleep between retries.

Copy link
Member

@sigmavirus24 sigmavirus24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no test for this and it purports to fix a bug on which no design was agreed

@ashwoods ashwoods marked this pull request as draft November 29, 2023 07:58
@ashwoods
Copy link
Author

ashwoods commented Nov 29, 2023

Sorry, meant to draft this from the start, PR was meant as a rough proposal and there a few things that are still unclear:

  • the original code returns None on error codes (type return mismatch).
  • we have been getting Connection errors, but retrying timeouts "might" be a good idea. (yes/no)?
  • should we add a sleep to the retries?

will add a test and a few improvements asap.

@@ -183,21 +183,31 @@ def upload(
) -> requests.Response:
number_of_redirects = 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I rename to retries? redirects aren't really handled here.

return resp

return resp
if resp.status_code == requests.codes.OK:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slighlty redundant, but can leave for clarity. Should add a continue to the retry if clause.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additionally, as the _upload function calls on POST without redirects, we aren't really handling anywhere (they are simply returned)

@ashwoods ashwoods marked this pull request as ready for review December 29, 2023 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants