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

Potential implementation of urllib3.util.Retry #269

Closed
wants to merge 4 commits into from

Conversation

kevinburke
Copy link
Contributor

Reference PR for #260 , as mentioned in the last commit

No tests, no docs, etc, just trying to push through this to see what the
logic's like. Some things I don't like:

  • it's fairly repetitive, we call increment/exhausted every time there's an
    error, and once when we have a response.
  • checking the response twice, once in increment and once in is_retryable
  • calling _connect_error_count from outside the class
  • conflict between individual retry and total retry values causing tests to
    fail, need to nail down this behavior
  • setting default timeout for a specific test instead of all of them

Kevin Burke added 4 commits October 20, 2013 00:39
No tests, no docs, etc, just trying to push through this to see what the
logic's like. Some things I don't like:

- it's fairly repetitive, we call increment/exhausted every time there's an
  error, and once when we have a response.
- checking the response twice, once in increment and once in is_retryable
- calling _connect_error_count from outside the class
- conflict between individual retry and total retry values causing tests to
  fail, need to nail down this behavior
- setting default timeout for a specific test instead of all of them
@@ -377,7 +377,7 @@ def is_same_host(self, url):

return (scheme, host, port) == (self.scheme, self.host, self.port)

def urlopen(self, method, url, body=None, headers=None, retries=3,
def urlopen(self, method, url, body=None, headers=None, retries=None,
Copy link
Member

Choose a reason for hiding this comment

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

Probably should be _Default to match timeout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason we needed _Default was because None has semantic value for a timeout. None doesn't mean anything for retries. We just need a sentinel, it's easy to change it.

Copy link
Member

Choose a reason for hiding this comment

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

None could have the semantic value of not having a retry limit (rather than use sys.maxint). At least that's what I feel we should do within the Retry(...) object, so it makes sense to have a similar semantic here? (I could also be convinced to allow True to be used interchangeably, but I feel None is more sensible because it often means "not specified", thus no restriction.)

_Default would be whatever sensible default we would like to provide.

0 (or maybe False could be used interchangeably) would have the semantic meaning of not allowing retries.

@shazow
Copy link
Member

shazow commented Jun 1, 2014

I think this PR is obsoleted by #326. Let me know if I'm mistaken.

@shazow shazow closed this Jun 1, 2014
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

2 participants